mbler 0.2.8-rc.6 → 0.2.8-rc.7
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/build.esm.mjs +4 -4
- package/dist/build.esm.mjs.map +1 -1
- package/dist/build.js +4 -4
- package/dist/build.js.map +1 -1
- package/dist/index.esm.mjs +4 -4
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/build.esm.mjs
CHANGED
|
@@ -97,13 +97,13 @@ var init_types = __esmMin((() => {
|
|
|
97
97
|
var version_default;
|
|
98
98
|
var init_version = __esmMin((() => {
|
|
99
99
|
version_default = {
|
|
100
|
-
commit: `commit
|
|
100
|
+
commit: `commit 97de736362daf4fa8f657d93e6c04ed75100f835
|
|
101
101
|
Author: ruanhor <3915264929@qq.com>
|
|
102
|
-
Date: Sun Jun 28 11:
|
|
102
|
+
Date: Sun Jun 28 11:23:01 2026 +0800
|
|
103
103
|
|
|
104
|
-
chore: update
|
|
104
|
+
chore: update @mbler/mcx-server dep to ^0.1.2-rc.1
|
|
105
105
|
`,
|
|
106
|
-
version: "0.2.8-rc.
|
|
106
|
+
version: "0.2.8-rc.7"
|
|
107
107
|
};
|
|
108
108
|
}));
|
|
109
109
|
//#endregion
|
package/dist/build.esm.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.esm.mjs","names":["version","version","fs","ZhLang","enLang","fileExists","path","fs","path","path","fs","Sapi","fs","chokidarWatch"],"sources":["../src/types.ts","../src/version.ts","../src/i18n/zh.ts","../src/i18n/en.ts","../src/i18n/index.ts","../src/commander/index.ts","../src/logger/index.ts","../src/build/config.ts","../src/utils/index.ts","../src/build/progress.ts","../src/build/cache.ts","../src/config.ts","../src/build/sapi.ts","../src/build/plugin-mcx-tsc.ts","../src/build/release.ts","../src/build/minify.ts","../src/uuid/index.ts","../src/build/manifest.ts","../src/build/index.ts"],"sourcesContent":["import { Plugin } from 'rolldown'\n\nexport const LanguageNames = ['zh', 'en']\nexport const cmdList = [\n 'c',\n 'work',\n 'help',\n 'h',\n 'init',\n 'version',\n 'build',\n 'watch',\n 'lang',\n 'set-work-dir',\n 'publish',\n 'unpublish',\n 'install',\n 'uninstall',\n 'login',\n 'profile',\n 'log',\n 'view',\n 'config',\n] as const\ntype HelpCommand = (typeof cmdList)[number]\nexport interface language {\n description: string\n help: {\n cmds: readonly string[]\n } & {\n [K in HelpCommand]: string\n }\n default: {\n unexpected: string\n youis: string\n }\n workdir: {\n set: string\n nfound: string\n disabled: string\n enabled: string\n invalidParam: string\n }\n init: {\n initDes: string\n name: string\n description: string\n useGIT: string\n useUI: string\n lang: string\n betaApi: string\n mcVersion: string\n noName: string\n noMCVersion: string\n noLanguare: string\n welcome: string\n }\n publish: {\n askTip: string\n notLoggedIn: string\n progress: string\n publishFailed: string\n publishing: string\n building: string\n publishToMarket: string\n publishSuccess: string\n publishResult: string\n projectPathNotExist: string\n outdirNotFound: string\n outdirNotExist: string\n readmeNotFound: string\n metadataInvalid: string\n packageNameInvalid: string\n nameMismatch: string\n notLoginError: string\n tokenMissing: string\n unpublishReqFailed: string\n createSessionFailed: string\n uploadZipFailed: string\n packageJsonNotFound: string\n noBuildScript: string\n buildFailed: string\n }\n install: {\n failedNoPackageJson: string\n failedNoBuildScript: string\n installing: string\n packageNotFound: string\n noVersion: string\n usingLatest: string\n noValidAddon: string\n success: string\n failed: string\n }\n uninstall: {\n success: string\n failed: string\n }\n unpublish: {\n success: string\n failed: string\n }\n view: {\n usage: string\n packageNotFound: string\n title: string\n versionLine: string\n failed: string\n }\n config: {\n usage: string\n missingArg: string\n getResult: string\n setSuccess: string\n pointGet: string\n pointSetSuccess: string\n pointSetFailed: string\n failed: string\n }\n commander: {\n selectTip: string\n }\n}\nexport interface MblerConfigScript {\n ui?: boolean // use minecraft module \"@minecraft/server-ui\"\n lang?: 'ts' | 'mcx' | 'js' // languare\n main: string // main file point(start <project>/behavior), be like: index.js\n UseBeta?: boolean // use beta minecraft api\n}\nexport interface MblerConfigOutdir {\n behavior?: string // behavior output dir, default: ./dist/dep\n resources?: string // resources output dir, default: ./dist/res\n dist: string // build use \"-dist\" option to build to a mcaddon file.\n}\nexport interface MblerBuildConfig {\n rollupPlugins: Plugin[]\n rollupExternal: string[]\n cache: 'none' | 'memory' | 'file' | 'filesystem' | 'auto'\n cachePath: string\n bundle: boolean\n clean?: boolean\n outputDir: string\n outputFilename: string\n onEnd: (ctx: MblerConfigData) => void | Promise<void>\n onStart: (ctx: MblerConfigData) => void | Promise<void>\n onWarn: (ctx: MblerConfigData, warning: Error) => void | Promise<void>\n}\nexport interface MblerConfigData {\n name: string // addon name (package scope, e.g. \"@scope/name\")\n displayName?: string // display name shown in manifest (falls back to name)\n outdir?: MblerConfigOutdir // output\n description: string // addon description\n version: string // version, like be \"0.0.1-beta\"\n mcVersion: string // use mcVersion, be like \"1.21.100\"\n script?: MblerConfigScript // sapi option\n minify?: 'oxc' | 'terser' | 'esbuild' // use minify\n build?: Partial<MblerBuildConfig> // build config\n}\nexport const templateMblerConfig: MblerConfigData = {\n name: 'demo',\n displayName: '',\n description: 'demo',\n version: '0.0.0',\n mcVersion: '1.21.100',\n minify: 'oxc',\n script: {\n main: '',\n },\n outdir: {\n behavior: '',\n resources: '',\n dist: '',\n },\n build: {\n rollupPlugins: [],\n cache: 'auto',\n bundle: true,\n outputDir: 'scripts',\n outputFilename: '',\n onEnd: () => {},\n onStart: () => {},\n onWarn: () => {},\n },\n}\nexport interface CliParam {\n params: string[]\n opts: Record<string, string>\n}\nexport interface ManifestData {\n format_version: number\n header: {\n name: string\n description: string\n uuid: string\n version: number[]\n min_engine_version: number[]\n }\n modules: Array<{\n type: 'script' | 'data' | 'resources'\n uuid: string\n description?: string\n version: number[]\n language?: string\n entry?: string\n }>\n dependencies?: Array<{\n module_name: string\n version: string\n }>\n subpack?: Array<{\n folder_name: string\n name: string\n memory_tier: number\n }>\n capabilities?: string[]\n}\nexport interface npmFetchData {\n name: string\n 'dist-tags': Record<string, string>\n versions: Record<\n string,\n {\n maintainers: {\n name: string\n mail: string\n }[]\n dist: {\n shasum: string\n tarball: string\n }\n author: {\n name: string\n mail: string\n }\n license: string\n version: string\n }\n >\n readme: string\n keywords: string[]\n homepage: string\n time: Record<string, string>\n}\nexport interface PMNXProfile {\n mail: string\n name: string\n uid: number\n avatar_url?: string\n ctime: string\n}\n\nexport interface PublishMetadata {\n readme: string\n scope: string\n name: string\n version: string\n version_tag: string\n}\nexport interface MNXPackageInfoResult {\n id: string\n readmeTable: [number, string][]\n versions: {\n download_url: string\n version_tag: string\n name: string\n create_user: PMNXProfile\n readme: number\n create_time: string // ISO Date string\n }[]\n download: number /**下载量 */\n}\nexport interface BaseResult {\n code: 200 | -1\n message: string\n success: boolean\n}\nexport interface MNXPackageVersionInfoResult {\n id: string\n versions: {\n download_url: string\n version_tag: string\n name: string\n create_user: PMNXProfile\n readme: string\n create_time: string // ISO Date string\n }\n}\n","export default { commit: `commit edde76432cb9fdd52fbb335f8ea53335a925a2ae\nAuthor: ruanhor <3915264929@qq.com>\nDate: Sun Jun 28 11:15:28 2026 +0800\n\n chore: update pnpm-lock.yaml for @mbler/mcx-server dep change\n`, version: \"0.2.8-rc.6\" }","import { cmdList, language } from '../types'\nimport version from '../version'\n\nexport default {\n description: `MBLER\nMinecraft Bedrock Edition\nAddon Bulider In Nodejs\n在基岩版我的世界上的 nodejs 构建工具\n命令 : ${cmdList.join(', ')}\n帮助命令 : \n help\n 显示帮助信息\n 第二个参数为要查询的命令名称或空\n 别名: h\ngit https://github.com/RuanhoR/mbler/`,\n help: {\n cmds: cmdList,\n help: 'mbler [help/h] [?:查看的命令名称]\\n - 查看帮助',\n h: '$help',\n work: 'mbler [work/c] [?:相对或绝对路径]\\n - 没有输入路径:查询当前工作目录\\n - 输入路径:设置工作目录',\n c: '$work',\n init: 'mbler init\\n - 初始化当前工作目录,可使用 mbler work 指定工作目录或使用参数一次确定(例: mbler init -in ./)\\n - 将会询问选项以完成初始化',\n build: 'mbler build\\n - 在工作目录执行构建',\n log: 'mbler log\\n - 处理日志文件\\n - mbler log point: 得到日志文件路径 \\n - mbler log clean: 清除日志',\n watch: 'mbler watch\\n - 启动构建并开启监视模式,文件变化会自动重新构建',\n lang: 'mbler lang\\n- 无参数:显示当前语言\\n- 跟 zh 或 en(如 mbler lang en): 设置语言',\n version:\n 'mbler version - 版本管理命令\\n- 无参数:显示当前版本和提交哈希\\n- --show=<commit|version>:筛选显示内容\\n- <新版本号>:更新package.json和配置文件的版本',\n 'set-work-dir':\n 'mbler set-work-dir <on|off>\\n - on: 启用工作目录功能\\n - off: 禁用工作目录功能,直接使用 process.cwd()',\n publish:\n 'mbler publish\\n - 将你的附加包发布到 pmnx\\n- 参数:\\n- -tag: 版本标签名称\\n- -build <skip|always>: 是否跳过构建(默认 always)',\n uninstall:\n 'mbler uninstall @<scope>/<name>@version\\n从你的游戏中移除一个包',\n install: 'mbler install @<scope>/<name>@version\\n将一个包安装到你的游戏中',\n unpublish:\n 'mbler unpublish @<scope>/<name>@version\\n从 pmnx 取消发布一个包',\n login:\n 'mbler login <?:token>\\n使用 token 登录你的 pmnx 账户\\n- 如果没有 token,会向你请求',\n profile: 'mbler profile\\n显示当前登录账户信息',\n view: 'mbler view @<scope>/<name>\\n查看包的版本列表',\n config:\n 'mbler config get <key>\\nmbler config set <key> <value>\\nmbler config point <path>\\nmbler config point get',\n },\n init: {\n useUI: '使用UI模块? (y/n): ',\n useGIT: '初始化GIT仓库? (y/n): ',\n name: '项目名称: ',\n welcome:\n '欢迎使用Mbler初始化向导 语言:中文 mbler 版本: ' + version.version,\n description: '项目描述: ',\n initDes: '初始化依赖? (y/n): ',\n lang: '选择项目语言: ',\n betaApi: '使用Beta Api? (y/n): ',\n mcVersion: '项目使用的mc版本(x.x.x): ',\n noLanguare: '没有输入项目语言,这是必要的',\n noName: '没有项目名称,这是必要的',\n noMCVersion: \"输入的 '支持的mc版本' 格式不对\",\n },\n default: {\n unexpected: '不正确的命令,',\n youis: '你是否想说: ',\n },\n workdir: {\n set: '[工作目录] 设置为: ',\n nfound: '找不到输入文件夹(无法创建或不是文件夹)',\n disabled: '工作目录功能已禁用,将使用当前目录',\n enabled: '工作目录功能已启用',\n invalidParam: '参数错误,请使用 on 或 off',\n },\n publish: {\n askTip:\n '输入MCBE游戏绝对目录 (如 /sdcard/Android/data/com.mojang.minecraftpe/files/games),以进行下一步: ',\n notLoggedIn: '未登录,请先执行 `mbler login <token>`',\n progress: '进度: {progress}%',\n publishFailed: '发布失败: {error}',\n publishing: '正在发布...',\n building: '正在构建项目...',\n publishToMarket: '正在上传到市场...',\n publishSuccess: '发布成功',\n publishResult: '+ {name}@{version} ({tag})',\n projectPathNotExist: '项目路径不存在',\n outdirNotFound: '未找到构建输出目录配置',\n outdirNotExist: '构建输出目录不存在',\n readmeNotFound: '未找到 README 文件',\n metadataInvalid: '元数据无效',\n packageNameInvalid: '包名格式必须是 @scope/name',\n nameMismatch: 'mbler.config.js 与 package.json 中的 name 必须一致',\n notLoginError: '未登录',\n tokenMissing: '获取 token 失败',\n unpublishReqFailed: '取消发布请求失败',\n createSessionFailed: '创建发布会话失败',\n uploadZipFailed: '上传 zip 文件失败',\n packageJsonNotFound: '未找到 package.json',\n noBuildScript: 'package.json 中未找到 build 脚本',\n buildFailed: '构建失败,退出码: {code}',\n },\n install: {\n failedNoPackageJson: '安装失败:工作目录必须包含 package.json',\n failedNoBuildScript: '安装失败:package.json 必须包含 build 脚本',\n installing: '正在安装包 {pkg}...',\n packageNotFound: '未找到包 {pkg}',\n noVersion: '包 {pkg} 没有可用版本',\n usingLatest: '使用最新版本 {version}',\n noValidAddon: '包内未找到有效 addon',\n success: '包 {pkg}@{version} 已安装为 {id}',\n failed: '安装失败: {error}',\n },\n uninstall: {\n success: '包 {pkg}@{version} 卸载成功',\n failed: '卸载失败: {error}',\n },\n unpublish: {\n success: '包 {pkg}@{version} 取消发布成功',\n failed: '取消发布失败: {error}',\n },\n view: {\n usage: 'mbler view @<scope>/<name>',\n packageNotFound: '未找到包 {pkg}',\n title: '包 {pkg} 版本列表:',\n versionLine: '- {version} [{tag}] by {user} at {time}',\n failed: '查看失败: {error}',\n },\n config: {\n usage:\n 'mbler config get <key> | set <key> <value> | point <path> | point get',\n missingArg: '参数不足',\n getResult: '{key} = {value}',\n setSuccess: '已设置 {key} = {value}',\n pointGet: '当前配置文件: {path}',\n pointSetSuccess: '配置文件指向已设置为: {path}',\n pointSetFailed: '配置文件指向设置失败: {error}',\n failed: '配置操作失败: {error}',\n },\n commander: {\n selectTip: '(按 b 确认,n 键选择下一个)',\n },\n} as language\n","import { cmdList, language } from '../types'\nimport version from '../version'\n\nexport default {\n description:\n 'MBLER\\nMinecraft Bedrock Edition\\nAddon Bulider In Nodejs\\nnodejs build tools on bedrock version of minecraft\\nCommands: ' +\n cmdList.join(', ') +\n '\\nHelp command:\\n help\\n Show help information\\n The second parameter is the name of the command to be queried or empty\\n Alias: -h, -help\\n git https://github.com/RuanhoR/mbler/',\n help: {\n cmds: cmdList,\n help: 'mbler [help/h] [?: command name]\\n - see tip',\n h: '$help',\n work: 'mbler [work/c] [?: path]\\n - No input path: see current work dir\\n - input path: set as current dir',\n c: '$work',\n init: 'mbler init\\n - Init current work dir, you can use `mbler work` command or use command param(like be: mbler init -in ./)',\n build: 'mbler build\\n - perform a build using the library API',\n b: '$build',\n log: 'mbler log\\n - Handler log file\\n - mbler log point: Get log file path \\n - mbler log clean: Remove Log',\n watch:\n 'mbler watch\\n - run build and enter watch mode; changes will trigger rebuilds',\n lang: 'mbler lang [?:language]\\n- No args: show current language\\n- language = \"zh” | “en\": set language',\n version:\n 'mbler version\\n - Version control command\\n- No args: Shows version + commit hash\\n- --show=<commit|version>: Filters output\\n- <new_version>: Updates version in both package.json and config file',\n 'set-work-dir':\n 'mbler set-work-dir <on|off>\\n - on: Enable work dir feature\\n - off: Disable work dir feature, use process.cwd() directly',\n publish:\n 'mbler publish\\n - Publish your package to pmnx\\n- Params:\\n- -tag: version tag name\\n- -build <skip|always>: skip or run build before publish (default: always)',\n uninstall:\n 'mbler uninstall @<scope>/<name>@version\\nRemove a package from your game',\n install:\n 'mbler install @<scope>/<name>@version\\nInstall a package to your game',\n unpublish:\n 'mbler unpublish @<scope>/<name>@version\\nUnpublish a package from pmnx',\n login: 'mbler login <?:token>\\nUse token login your pmnx account',\n profile: 'mbler profile\\nShow current logged-in account profile',\n view: 'mbler view @<scope>/<name>\\nShow package versions',\n config:\n 'mbler config get <key>\\nmbler config set <key> <value>\\nmbler config point <path>\\nmbler config point get',\n },\n init: {\n useUI: 'Use UI? (y/n): ',\n useGIT: 'Initialize GIT repository? (y/n): ',\n name: 'Project name: ',\n description: 'Project description: ',\n initDes: 'Initialize dependencies? (y/n): ',\n welcome:\n 'Welcome to use Mbler init wizard! Language: English mbler version: ' +\n version.version,\n lang: 'Project language: ',\n betaApi: 'use beta api(y/n): ',\n mcVersion: 'Minecraft version(be like: x.x.x): ',\n noLanguare: 'project language is required',\n noMCVersion: 'project mcVersion format is not right',\n noName: 'project name is required',\n },\n default: {\n unexpected: 'Not found this command,',\n youis: 'You want to input: ',\n },\n workdir: {\n set: '[path to]: ',\n nfound: \"not found this dir(can't create or not directory)\",\n disabled: 'Work dir disabled, will use current directory',\n enabled: 'Work dir enabled',\n invalidParam: 'Invalid parameter, use on or off',\n },\n publish: {\n askTip:\n 'Plase input the absolute path of your MCBE game directory (like /sdcard/Android/data/com.mojang.minecraftpe/files/games) for next step: ',\n notLoggedIn: 'Not logged in. Use `mbler login <token>` first.',\n progress: 'Progress: {progress}%',\n publishFailed: 'Publish failed: {error}',\n publishing: 'Publishing...',\n building: 'Building project...',\n publishToMarket: 'Publishing to marketplace...',\n publishSuccess: 'Publish successful',\n publishResult: '+ {name}@{version} ({tag})',\n projectPathNotExist: 'Project path does not exist',\n outdirNotFound: 'Build output directories not found',\n outdirNotExist: 'Build output directories do not exist',\n readmeNotFound: 'README file not found',\n metadataInvalid: 'Invalid metadata',\n packageNameInvalid: 'Package name must be in the format of @scope/name',\n nameMismatch: 'Package name in mbler.config.js and package.json must match',\n notLoginError: 'Not logged in',\n tokenMissing: 'Failed to get token',\n unpublishReqFailed: 'Failed to unpublish package',\n createSessionFailed: 'Failed to create publish session',\n uploadZipFailed: 'Failed to upload zip file',\n packageJsonNotFound: 'package.json not found',\n noBuildScript: 'No build script found in package.json',\n buildFailed: 'Build failed with code {code}',\n },\n install: {\n failedNoPackageJson:\n 'Install failed: work directory must contain package.json',\n failedNoBuildScript:\n 'Install failed: package.json must contain a build script',\n installing: 'Installing package {pkg}...',\n packageNotFound: 'Package {pkg} not found',\n noVersion: 'Package {pkg} has no available version',\n usingLatest: 'Using latest version {version}',\n noValidAddon: 'No valid addon found in package',\n success: 'Package {pkg}@{version} installed successfully as {id}',\n failed: 'Install failed: {error}',\n },\n uninstall: {\n success: 'Package {pkg}@{version} uninstalled successfully',\n failed: 'Uninstall failed: {error}',\n },\n unpublish: {\n success: 'Package {pkg}@{version} unpublished successfully',\n failed: 'Unpublish failed: {error}',\n },\n view: {\n usage: 'mbler view @<scope>/<name>',\n packageNotFound: 'Package {pkg} not found',\n title: 'Package {pkg} versions:',\n versionLine: '- {version} [{tag}] by {user} at {time}',\n failed: 'View failed: {error}',\n },\n config: {\n usage:\n 'mbler config get <key> | set <key> <value> | point <path> | point get',\n missingArg: 'Missing argument',\n getResult: '{key} = {value}',\n setSuccess: 'Set {key} = {value}',\n pointGet: 'Current config file: {path}',\n pointSetSuccess: 'Config file pointer set to: {path}',\n pointSetFailed: 'Failed to set config pointer: {error}',\n failed: 'Config command failed: {error}',\n },\n commander: {\n selectTip: '(Press b to confirm, n to select next)',\n },\n} as language\n","import fs from 'node:fs'\nimport ZhLang from './zh.js'\nimport enLang from './en.js'\nimport path from 'node:path'\nimport { language, LanguageNames } from '../types.js'\nimport { homedir } from 'node:os'\nconst configPath = path.join(\n homedir(), // ~/.cache/mbler/lang.db: push language config\n '.cache/mbler/lang.db'\n)\nfunction isLanguageName(\n language: string\n): language is (typeof LanguageNames)[number] {\n return LanguageNames.includes(language)\n}\nclass Lang {\n currentLang: (typeof LanguageNames)[number] = 'zh'\n init() {\n try {\n const TheyLang = fs.readFileSync(configPath, 'utf-8').toString().trim()\n if (isLanguageName(TheyLang)) {\n this.currentLang = TheyLang\n } else {\n throw new Error('[setup lang]: set lang error')\n }\n } catch {\n this.currentLang = 'zh'\n }\n }\n set(newLang: (typeof LanguageNames)[number]) {\n if (LanguageNames.includes(newLang)) {\n if (!fs.existsSync(configPath)) {\n fs.mkdirSync(path.dirname(configPath), {\n recursive: true,\n })\n }\n fs.writeFileSync(configPath, newLang)\n this.currentLang = newLang\n return true\n }\n return false\n }\n get() {\n try {\n if (this.currentLang == 'zh') return ZhLang\n return enLang\n } catch {\n return ZhLang\n }\n }\n}\ninterface lang extends language {\n __internal: {\n class: Lang\n set: (newLang: (typeof LanguageNames)[number]) => void\n }\n}\nconst lang = new Lang()\nconst i18n: lang = {} as unknown as lang\nfunction Export(lang: Lang) {\n const obj = lang.get()\n Object.setPrototypeOf(i18n, {\n ...obj,\n __internal: {\n class: lang,\n set: (newLang: (typeof LanguageNames)[number]) => {\n lang.set(newLang)\n Export(lang)\n },\n },\n })\n}\n\nlang.init()\nExport(lang)\nexport default i18n\n","import * as readline from 'readline'\nimport i18n from '../i18n/index.js'\nif (process.stdin.isTTY) {\n process.stdin.setRawMode(true)\n readline.emitKeypressEvents(process.stdin)\n}\ninterface KeyPromise {\n name: string\n ctrl: boolean\n alt: boolean\n resolve: () => void\n}\n\nconst promises: KeyPromise[] = []\nconst tasks: Array<\n (name: string, ctrl: boolean, alt: boolean, raw: string) => void\n> = []\nprocess.on('exit', (_code) => {\n process.stdout.write('\\x1b[?25h')\n})\nconst endTasks: (() => void)[] = []\nexport function onEnd(task: () => void) {\n endTasks.push(task)\n}\nclick('c', {\n ctrl: true,\n}).then(() => {\n endTasks.forEach((task) => task())\n process.exit(0)\n})\nfunction handler(\n name: string,\n {\n ctrl,\n alt,\n }: {\n ctrl: boolean\n alt: boolean\n },\n raw: string\n) {\n const find = promises.find(\n (e) => e.name === name && e.ctrl === ctrl && e.alt === alt\n )\n if (find) {\n find.resolve()\n promises.splice(promises.indexOf(find), 1)\n }\n tasks.forEach((item) => item(name, ctrl, alt, raw))\n}\nexport function click(\n name: string,\n {\n ctrl = false,\n alt = false,\n }: {\n ctrl?: boolean\n alt?: boolean\n }\n): Promise<void> {\n return new Promise((resolve) => {\n promises.push({\n name,\n ctrl: ctrl || false,\n alt: alt || false,\n resolve,\n })\n })\n}\nexport class Input {\n static render(arr: string[], index: number): string {\n return arr\n .map((item, pindex) => {\n if (pindex === index) return '\\x1b[1m\\x1b[32m' + item + '\\x1b[0m' // 亮绿,高亮\n return '\\x1b[1m\\x1b[33m' + item + '\\x1b[0m' // 亮黄\n })\n .join(' ')\n }\n static select<T extends string[]>(tip: string, arr: T): Promise<T[number]> {\n let index: number = 0\n let win = false\n\n console.log(\n `\\x1b[2K\\x1b[47m\\x1b[1m\\x1b[30m${tip} ${i18n.commander.selectTip} \\x1b[0m\\x1b[?25l`\n )\n console.log(Input.render(arr, index) + '\\n\\x1b[1A')\n\n const handlerNext = () => {\n if (win) return\n index++\n if (index >= arr.length) index = 0\n console.log(`\\x1b[1A${Input.render(arr, index)}\\n\\x1b[1A`)\n click('n', {\n ctrl: false,\n alt: false,\n }).then(handlerNext)\n }\n\n return new Promise((resolve) => {\n click('n', {\n ctrl: false,\n alt: false,\n }).then(handlerNext)\n click('b', {\n ctrl: false,\n alt: false,\n }).then(() => {\n win = true\n process.stdout.write('\\x1b[?25h')\n resolve(arr[index]!)\n })\n })\n }\n static use(\n task: (name: string, ctrl: boolean, alt: boolean, raw: string) => void\n ) {\n tasks.push(task)\n }\n}\nprocess.stdin.on('keypress', (str: string, key) => {\n const rawKeyName = key?.name || ''\n const ctrl = Boolean(key?.ctrl)\n const alt = Boolean(key?.alt)\n\n handler(\n rawKeyName,\n {\n ctrl,\n alt,\n },\n str\n )\n})\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport os from 'node:os'\nconst logFile = path.join(os.homedir(), '.cache/mbler/latest.log')\n\nfunction _clean(promise: Promise<void>): () => void {\n return () => {\n Logger.run = Logger.run.filter((item: Promise<void>) => {\n return item !== promise\n })\n }\n}\nasync function fileExists(file: string): Promise<boolean> {\n try {\n const f = await fs.stat(file)\n if (f) return true\n } catch {\n return false\n }\n return false\n}\nfunction writeLog(logContent: string): void {\n async function write() {\n try {\n const dir = path.dirname(logFile)\n if (!(await fileExists(dir))) {\n // ensure the directory exists, root-to-leaf\n await fs.mkdir(dir, { recursive: true }).catch(() => void 0)\n }\n // if file does not exist, create it (touch)\n if (!(await fileExists(logFile))) {\n await fs.writeFile(logFile, '')\n }\n } catch (err) {\n // if we can't prepare the log file, output to stderr but don't crash\n console.error('[logger] unable to prepare log file:', err)\n return\n }\n\n try {\n await fs.appendFile(logFile, '\\n' + logContent)\n } catch (err) {\n console.error('[logger] failed to append to log file:', err)\n }\n }\n const asy = write()\n Logger.run.push(asy.then(_clean(asy)))\n}\nexport default class Logger {\n public static LogFile = logFile\n public static run: Promise<void>[] = []\n private static _b(tag: string, msg: string, t: string): void {\n const date = new Date()\n const logContent = [\n `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`,\n `[${t} ${tag}]`,\n msg,\n ].join(' ')\n writeLog(logContent)\n }\n public static w(tag: string, msg: string): void {\n Logger._b(tag, msg, 'WARN')\n }\n public static e(tag: string, msg: string): void {\n Logger._b(tag, msg, 'ERROR')\n }\n public static i(tag: string, msg: string): void {\n Logger._b(tag, msg, 'INFO')\n }\n public static d(tag: string, msg: string): void {\n Logger._b(tag, msg, 'DEBUG')\n }\n}\n","type includesGroup = Record<string, 'file' | 'directory' | 'skip'>\nexport const BuildConfig = {\n ConfigFile: 'mbler.config.js' as const,\n salt: {\n header: 'd61e721d-a2c9-4535-8054-0183bce24767',\n sapi: '33e2c698-908f-45ab-8a9f-66018f8486ed',\n module: 'cbbacfa4-8b1e-4a9c-9cbd-7a0d2e5f0b3c',\n } as const,\n behavior: 'behavior' as const,\n resources: 'resources' as const,\n includes: {\n public: {\n 'pack_icon.png': 'file',\n 'manifest.json': 'file',\n },\n resources: {\n 'biomes_client.json': 'file',\n 'blocks.json': 'file',\n 'bug_pack_icon.png': 'file',\n 'contents.json': 'file',\n 'loading_messages.json': 'file',\n 'manifest_publish.json': 'file',\n 'signatures.json': 'file',\n 'sounds.json': 'file',\n 'splashes.json': 'file',\n animation_controllers: 'directory',\n animations: 'directory',\n attachables: 'directory',\n biomes: 'directory',\n cameras: 'directory',\n entity: 'directory',\n fogs: 'directory',\n font: 'directory',\n items: 'directory',\n library: 'directory',\n materials: 'directory',\n models: 'directory',\n particles: 'directory',\n render_controllers: 'directory',\n sounds: 'directory',\n texts: 'directory',\n textures: 'directory',\n },\n behavior: {\n aim_assist: 'directory',\n animation_controllers: 'directory',\n animations: 'directory',\n behavior_trees: 'directory',\n biomes: 'directory',\n blocks: 'directory',\n cameras: 'directory',\n dimensions: 'directory',\n entities: 'directory',\n feature_rules: 'directory',\n features: 'directory',\n functions: 'directory',\n item_catalog: 'directory',\n items: 'directory',\n loot_tables: 'directory',\n recipes: 'directory',\n /**\n * Skipped from the default copy flow; handled separately by the build:\n * - bundle: true → bundled via rollup\n * - bundle: false → copied as-is into the output\n */\n scripts: 'skip',\n spawn_rules: 'directory',\n structures: 'directory',\n texts: 'directory',\n trading: 'directory',\n worldgen: 'directory',\n 'contents.json': 'file',\n 'manifest_publish.json': 'file',\n 'signatures.json': 'file',\n },\n } as {\n public: includesGroup\n behavior: includesGroup\n resources: includesGroup\n },\n}\n","import * as fs from 'node:fs/promises'\nimport * as path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { MblerConfigData, templateMblerConfig } from '../types'\nimport { Input } from '../commander'\nimport { spawn } from 'node:child_process'\nimport { BuildConfig } from '../build/config'\nimport Logger from '../logger'\nexport function join(baseDir: string, inputPath: string): string {\n return path.isAbsolute(inputPath) ? inputPath : path.join(baseDir, inputPath)\n}\nexport async function ReadProjectMblerConfig(\n project: string\n): Promise<MblerConfigData> {\n const configPath = path.join(project, BuildConfig.ConfigFile)\n const fileExport = await import(\n process.platform === 'win32' ? pathToFileURL(configPath).href : configPath\n )\n const file = (fileExport as { default: MblerConfigData }).default || {}\n for (const key in file) {\n if (!(key in templateMblerConfig)) {\n throw new Error(\n `[read config]: read config from '${project}' error: Unexpected '${key}'`\n )\n }\n }\n const config: MblerConfigData = {\n ...templateMblerConfig,\n ...file,\n }\n try {\n const pkgRaw = await fs.readFile(\n path.join(project, 'package.json'),\n 'utf-8'\n )\n const pkg = JSON.parse(pkgRaw)\n if (file.name && pkg.name && file.name !== pkg.name) {\n throw new Error(\n `Package name mismatch: mbler.config.js (\"${file.name}\") != package.json (\"${pkg.name}\"). They must match.`\n )\n }\n if (pkg.name) config.name = pkg.name\n if (pkg.version) config.version = pkg.version\n } catch {\n // fallback to mbler.config.js or template defaults\n }\n if (!config.name) config.name = 'unknown'\n if (!config.version) config.version = '0.0.0'\n return config\n}\nexport async function readFileAsJson<T>(filePath: string): Promise<T> {\n try {\n const content = await fs.readFile(filePath, 'utf-8')\n const json = JSON.parse(content)\n return json as T\n } catch (err: unknown) {\n if (err instanceof Error) {\n throw err\n } else {\n throw new Error(err as string, { cause: err })\n }\n }\n}\nexport function sleep(time: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, time)\n })\n}\n/**\n * Print a single-line message to stdout with a trailing newline.\n * Exported here so other modules (for example `build`) do not need\n * to import from `cli`, avoiding a circular dependency.\n */\nlet outputQueue: string[] = []\nlet isFlushing = false\n\nexport async function flushOutputQueue(): Promise<void> {\n if (isFlushing || outputQueue.length === 0) return\n isFlushing = true\n try {\n while (outputQueue.length > 0) {\n const chunk = outputQueue.shift()\n if (chunk) {\n process.stdout.write(chunk)\n }\n }\n } finally {\n isFlushing = false\n }\n}\nprocess.on('exit', flushOutputQueue)\nexport function showText(text: string, needNextLine: boolean = true) {\n outputQueue.push(text + (needNextLine ? '\\n' : ''))\n if (!isFlushing) {\n Promise.resolve()\n .then(() => flushOutputQueue())\n .catch(() => {\n outputQueue = []\n isFlushing = false\n })\n }\n}\nexport function stringToNumberArray(str: string): [number, number, number] {\n return str\n .split('.')\n .map((s) => parseInt(s, 10))\n .slice(0, 3) as [number, number, number]\n}\nexport async function writeJSON(\n filePath: string,\n data: unknown\n): Promise<void> {\n const content = JSON.stringify(data, null, 2)\n if (!(await fileExists(path.dirname(filePath)))) {\n await fs\n .mkdir(path.dirname(filePath), { recursive: true })\n .catch(() => void 0)\n }\n return await fs.writeFile(filePath, content, 'utf-8')\n}\nexport function compareVersion(a: string, b: string): number {\n const pa = a.split('.').map((x) => parseInt(x, 10) || 0)\n const pb = b.split('.').map((x) => parseInt(x, 10) || 0)\n for (let i = 0; i < 3; i++) {\n const na = pa[i] || 0\n const nb = pb[i] || 0\n if (na !== nb) return na - nb\n }\n return 0\n}\nexport const input = (function (): (t: string, g?: boolean) => Promise<string> {\n type InputCallBack = (a: string) => void\n let curr: null | InputCallBack\n let currstr = ''\n let tip = ''\n let show = true\n // 在输入时使用输入中间件\n Input.use(function (\n raw: string,\n ctrl: boolean,\n alt: boolean,\n name: string\n ): void {\n if (typeof curr !== 'function') return\n if (ctrl || alt) return\n if (raw) {\n if (raw === 'return' || raw === 'enter') {\n curr(currstr)\n curr = null\n currstr = ''\n console.log('\\n')\n return\n }\n if (raw === 'backspace') {\n currstr = currstr.slice(0, -1)\n refreshInput()\n return\n }\n }\n if (name && typeof name === 'string') {\n currstr += name\n refreshInput()\n }\n })\n\n function refreshInput(): void {\n const out = `\\x1b[2K\\r${tip}${show ? currstr : ''}`\n process.stdout.write(out)\n }\n /**\n * 输入文本\n * @param{string} tip 提示\n * @param{boolean} show 是否显示输入\n */\n return async function (t: string = '', g: boolean = true): Promise<string> {\n return new Promise((resolve) => {\n flushOutputQueue().then(() => {\n show = g\n tip = t\n refreshInput()\n curr = resolve\n })\n })\n }\n})()\nexport function isValidVersion(version: string): boolean {\n const split = version.split('-')\n if (!split[0]) return false\n if (\n (split[0] as string)\n .split('.')\n .map(Number)\n .filter((i) => !Number.isNaN(i)).length !== 3\n )\n return false\n return true\n}\nexport function runCommand(\n param: string[],\n cwd: string,\n stdio: 'ignore' | 'pipe' | 'inherit'\n): Promise<{ code: number | null; data: string }> {\n let resolve: (result: { code: number | null; data: string }) => void\n let data = ''\n const promise = new Promise<{ code: number | null; data: string }>(\n (r) =>\n (resolve = (...argv) => {\n Logger.i(\n 'Utils: runCommand',\n `run command: '${param.join(' ')}' return: ${JSON.stringify(argv[0])}`\n )\n r(...argv)\n })\n )\n const p = spawn(param[0] as string, param.slice(1), {\n cwd: cwd,\n shell: process.platform === 'win32',\n stdio: stdio,\n timeout: 1000 * 60 * 10,\n })\n if (p.stdout) {\n p.stdout.on('data', (chunk: Buffer) => {\n data += chunk.toString()\n })\n }\n p.on('error', (_err) => {\n resolve({ code: -1, data })\n })\n p.on('close', (code) => {\n resolve({ code, data })\n })\n return promise\n}\nexport async function fileExists(file: string) {\n try {\n await fs.stat(file)\n return true\n } catch {\n return false\n }\n}\nconst README_CANDIDATES = [\n 'README.md',\n 'readme.md',\n 'Readme.md',\n 'README.MD',\n 'readme.MD',\n 'Readme.MD',\n 'README.markdown',\n 'readme.markdown',\n 'Readme.markdown',\n 'README',\n]\nexport async function findReadme(dir: string): Promise<string | null> {\n for (const name of README_CANDIDATES) {\n const full = path.join(dir, name)\n if (await fileExists(full)) return full\n }\n return null\n}\n","import { styleText } from 'node:util'\nimport { showText } from '../utils'\nexport class Progress {\n private max: number\n constructor(max: number) {\n this.max = max\n }\n\n update(current: number) {\n const percentage = Math.min(current, this.max) / this.max\n const barWidth = 30\n const filledWidth = Math.round(barWidth * percentage)\n const emptyWidth = barWidth - filledWidth\n const filledBar = styleText('green', '█'.repeat(filledWidth))\n const emptyBar = styleText('white', '█'.repeat(emptyWidth))\n const progressBar = `${filledBar}${emptyBar}`\n const percentText = styleText('blue', `${Math.round(percentage * 100)}%`)\n const progressText = `\\n\\u001B[1A\\r[${progressBar}] ${percentText} (${current}/${this.max})`\n showText(progressText, false)\n if (current == this.max) {\n showText('', true)\n }\n }\n}\n","export type BuildCacheMode = 'none' | 'memory' | 'file' | 'filesystem' | 'auto'\ntype EffectiveCacheMode = 'none' | 'memory' | 'file'\n\nexport class BuildCacheManager {\n private readonly mode: EffectiveCacheMode\n\n constructor(\n _projectRoot: string,\n mode: BuildCacheMode | undefined,\n _cachePath?: string\n ) {\n this.mode = this.resolveMode(mode)\n }\n\n public getMode() {\n return this.mode\n }\n\n public shouldUseIncrementalBuild(): boolean {\n return this.mode !== 'none'\n }\n\n private resolveMode(mode: BuildCacheMode | undefined): EffectiveCacheMode {\n if (mode === 'none') return 'none'\n return 'file'\n }\n}\n","import { tmpdir } from 'node:os'\nimport * as path from 'node:path'\n\nconst config = {\n tmpdir: path.join(tmpdir(), '.mbler'),\n mcxVersion: '0.0.2-beta.r7',\n mcxCoreVersion: '0.0.6',\n mblerVersion: '0.2.4-rc.4',\n defaultPmnxBASE: 'https://d.pmnx.qzz.io',\n}\nexport default config\n","import * as path from 'node:path'\nimport * as fs from 'node:fs'\nimport config from '../config'\nimport { compareVersion, sleep } from '../utils'\nimport type { npmFetchData } from '../types'\n\nexport interface cacheValue {\n formal: string\n beta: string\n}\n\nconst Sapi = function (): {\n refresh: () => Promise<void>\n generateVersion: (\n module: '@minecraft/server-ui' | '@minecraft/server',\n mcVersion: string,\n isBeta: boolean,\n withFull: boolean\n ) => Promise<string>\n} {\n const MAX_RETRIES = 3\n\n async function json(path: string, attempt = 1) {\n const r = await fetch('https://registry.npmjs.com' + path)\n if (!r.ok && attempt < MAX_RETRIES) {\n await sleep(1000 * attempt)\n return json(path, attempt + 1)\n }\n return await r.json()\n }\n\n const cacheFile = path.join(config.tmpdir, '_sapi_version.json')\n let cacheData: Array<{\n version: string\n server: cacheValue\n 'server-ui': cacheValue\n }> | null = null\n\n async function fetchData(\n pkgName: string\n ): Promise<Record<string, cacheValue>> {\n const data = (await json(`/${pkgName}`)) as unknown as npmFetchData\n const pkgVersions = Object.keys(data.versions)\n const reValue: Record<string, cacheValue> = {}\n\n const mcVersionFrom = (str: string): string | null => {\n const m = str.match(/-(?:rc|beta)(?:\\.[^-.]+)*?\\.((?:\\d+\\.){2}\\d+)/)\n return m ? (m[1] as string) : null\n }\n\n for (const v of pkgVersions) {\n const mcVersion = mcVersionFrom(v)\n if (!mcVersion) continue\n\n const isStable = /(?:-stable)(?:$|[-.])/.test(v)\n let entry = reValue[mcVersion]\n if (!entry) {\n entry = { formal: '', beta: '' }\n reValue[mcVersion] = entry\n }\n\n if (isStable) {\n if (!entry.formal || compareVersion(v, entry.formal) > 0) {\n entry.formal = v\n }\n } else {\n if (!entry.beta || compareVersion(v, entry.beta) > 0) {\n entry.beta = v\n }\n }\n }\n\n return reValue\n }\n\n async function refresh() {\n const serverMap = await fetchData('@minecraft/server')\n const uiMap = await fetchData('@minecraft/server-ui')\n const versions = new Set([\n ...Object.keys(serverMap),\n ...Object.keys(uiMap),\n ])\n\n const arr: Array<{\n version: string\n server: cacheValue\n 'server-ui': cacheValue\n }> = []\n\n for (const ver of versions) {\n arr.push({\n version: ver,\n server: serverMap[ver] ?? { formal: '', beta: '' },\n 'server-ui': uiMap[ver] ?? { formal: '', beta: '' },\n })\n }\n\n arr.sort((a, b) => compareVersion(a.version, b.version))\n cacheData = arr\n\n await fs.promises.mkdir(config.tmpdir, { recursive: true }).catch(() => {})\n await fs.promises.writeFile(cacheFile, JSON.stringify(arr, null, 2), 'utf-8')\n }\n\n async function generateVersion(\n module: '@minecraft/server-ui' | '@minecraft/server',\n mcVersion: string,\n isBeta: boolean,\n withFull: boolean = false\n ): Promise<string> {\n if (!cacheData) {\n try {\n const txt = await fs.promises.readFile(cacheFile, 'utf-8')\n cacheData = JSON.parse(txt)\n } catch {\n await refresh()\n }\n }\n\n if (!cacheData) {\n throw new Error(\n 'unable to load SAPI version data. Check network connectivity or delete ~/.mbler/_sapi_version.json and try again.'\n )\n }\n\n let entry = cacheData.find((e) => e.version === mcVersion)\n if (!entry) {\n let candidate: (typeof cacheData)[0] | null = null\n for (const e of cacheData) {\n if (compareVersion(e.version, mcVersion) <= 0) {\n candidate = e\n } else {\n break\n }\n }\n entry = candidate ?? cacheData[0]\n }\n\n if (!entry) {\n throw new Error(\n `no SAPI version data found for Minecraft version ${mcVersion}`\n )\n }\n\n const moduleKey = module === '@minecraft/server' ? 'server' : 'server-ui'\n const entryModule = entry[moduleKey]\n let result = isBeta ? entryModule.beta : entryModule.formal\n if (!result) {\n result = entryModule.formal || entryModule.beta\n }\n if (withFull) return result || ''\n return evalVersion(result || 'error')\n }\n\n return {\n refresh,\n generateVersion,\n }\n}\n\nlet sapiEmul: null | ReturnType<typeof Sapi> = null\nexport default new Proxy(\n {},\n {\n get(_, p) {\n if (!sapiEmul) sapiEmul = Sapi()\n return sapiEmul[p as keyof typeof sapiEmul]\n },\n set(_, p, n) {\n if (!sapiEmul) sapiEmul = Sapi()\n sapiEmul[p as keyof typeof sapiEmul] = n\n return true\n },\n }\n) as ReturnType<typeof Sapi>\n\nexport function evalVersion(result: string): string {\n const tmp = result.split('-').slice(0, 2) as [string, string]\n tmp[1] = tmp[1].split('.')[0] as string\n return tmp.join('-')\n}\n","import { createMCXLanguagePlugin } from '@mbler/mcx-server'\nimport { LanguagePlugin } from '@volar/language-core'\nimport { runTsc } from '@volar/typescript/lib/quickstart/runTsc.js'\n\n/**\n * 运行 MCX TypeScript 编译器\n * 为 .mcx 文件提供 TypeScript 类型检查支持\n */\nexport function runTSC(\n tscpath: string = require.resolve('typescript/lib/tsc')\n): void {\n runTsc(\n tscpath,\n {\n extraSupportedExtensions: [\n '.mcx',\n '.png',\n '.svg',\n '.jpg',\n '.jpeg',\n '.gif',\n ],\n extraExtensionsToRemove: [\n '.mcx',\n '.png',\n '.svg',\n '.jpg',\n '.jpeg',\n '.gif',\n ],\n },\n (ts): LanguagePlugin<string>[] => {\n return [createMCXLanguagePlugin(ts) as unknown as LanguagePlugin<string>]\n }\n )\n}\n\nexport default runTSC\n","import { env } from 'node:process'\nimport type AdmZip from 'adm-zip'\nfunction Release() {\n const AdmZip = require('adm-zip')\n function createFullZip(dir: string): AdmZip {\n const zip = new AdmZip()\n zip.addLocalFolder(dir)\n return zip\n }\n function createZipWithMoreFolder(dir: [string, string][]): AdmZip {\n const zip = new AdmZip()\n for (const folder of dir) {\n zip.addLocalFolder(folder[0], folder[1])\n }\n return zip\n }\n return async function generateRelease(build: {\n outdirs: {\n behavior: string\n resources: string\n dist: string\n }\n module: 'all' | 'behavior' | 'resources'\n }) {\n if (!build.outdirs) throw new Error('invalid Build')\n if (env.BUILD_MODULE !== 'release') return\n let zip: AdmZip\n if (build.module == 'all') {\n zip = createZipWithMoreFolder([\n [build.outdirs?.behavior, 'behavior'],\n [build.outdirs?.resources, 'resources'],\n ])\n } else if (build.module == 'behavior') {\n zip = createFullZip(build.outdirs?.behavior)\n } else {\n zip = createFullZip(build.outdirs?.resources)\n }\n await zip.writeZipPromise(build.outdirs?.dist as string)\n }\n}\nlet releaseEmul: ReturnType<typeof Release> | null = null\nconst generateRelease: ReturnType<typeof Release> = (...argv) => {\n if (!releaseEmul) releaseEmul = Release()\n return releaseEmul(...argv)\n}\nexport { generateRelease }\n","import { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { type Plugin } from 'rolldown'\n\nfunction resolvePackage(name: string, baseBuildDir: string): string {\n const require = createRequire(path.join(baseBuildDir, 'noop.js'))\n try {\n return require.resolve(name, { paths: [baseBuildDir] })\n } catch {\n throw new Error(\n `\\`${name}\\` is required for minification. Install it in your project:\\n` +\n ` npm i -D ${name}\\n` +\n ` pnpm add -D ${name}\\n` +\n ` yarn add -D ${name}`\n )\n }\n}\n\nexport function terserPlugin(baseBuildDir: string): Plugin {\n return {\n name: 'mbler:terser',\n async generateBundle(_, bundle) {\n const terserPath = pathToFileURL(\n resolvePackage('terser', baseBuildDir)\n ).href\n const terser: typeof import('terser') = await import(terserPath)\n for (const [, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n const res = await terser.minify(chunk.code, {\n format: { comments: false },\n compress: { unused: true, dead_code: true, if_return: true },\n })\n if (res.code) chunk.code = res.code\n }\n },\n }\n}\n\nexport function esbuildPlugin(baseBuildDir: string): Plugin {\n return {\n name: 'mbler:esbuild',\n async generateBundle(_, bundle) {\n const esbuildPath = pathToFileURL(\n resolvePackage('esbuild', baseBuildDir)\n ).href\n const esbuild: typeof import('esbuild') = await import(esbuildPath)\n for (const [, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n const res = await esbuild.transform(chunk.code, {\n minify: true,\n loader: 'js',\n })\n chunk.code = res.code\n }\n },\n }\n}\n","/**\n * @description To generate uuid\n */\nimport crypto from 'node:crypto'\nexport const fromString = (input: string, salt: string = ''): string => {\n const combinedInput = salt + input\n const hash = crypto.createHash('sha256').update(combinedInput).digest('hex')\n const base = hash.slice(0, 32)\n const ls = '89ab'\n const r = (t: number) =>\n ls[(combinedInput.length + t + salt.length) % ls.length]\n // build to:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n const uuid = `${base.substring(0, 8)}-${base.substring(8, 12)}-4${base.substring(12, 15)}-8${r(1)}${r(2)}${r(3)}-${base.substring(18, 30)}`\n return uuid\n}\nexport default {\n fromString,\n uuid: crypto.randomUUID,\n}\n","import { extname } from 'node:path'\nimport { ManifestData, MblerConfigData } from '../types'\nimport { stringToNumberArray } from '../utils'\nimport { fromString } from '../uuid'\nimport { BuildConfig } from './config'\nimport Sapi from './sapi'\nimport { evalVersion } from './sapi'\nasync function generateManifest(\n config: MblerConfigData,\n type: 'data' | 'resources'\n): Promise<ManifestData> {\n const hashRaw = `${config.name}-${type}-${config.script?.lang || 'js'}--mbler-hash-raw--:build-manifest`\n const manifest: ManifestData = {\n format_version: 2,\n header: {\n name: config.displayName || config.name,\n description: config.description,\n uuid: fromString(hashRaw, BuildConfig.salt.header),\n version: stringToNumberArray(config.version),\n min_engine_version: stringToNumberArray(\n typeof config.mcVersion === 'string'\n ? config.mcVersion\n : (() => {\n throw new Error('mcVersion in mblerconfig should be a string')\n })()\n ),\n },\n modules: [\n {\n type: type,\n uuid: fromString(hashRaw, BuildConfig.salt.module),\n description: `From Mbler(https://github.com/RuanhoR/mbler). welcome to star and contribute!`,\n version: stringToNumberArray(config.version),\n },\n ],\n }\n if (type === 'data' && config.script) {\n const isBundle = config.build?.bundle !== false\n const outputDir = config.build?.outputDir || 'scripts'\n let entry: string\n if (isBundle) {\n let filename = config.script.main || 'index.js'\n if (config.build?.outputFilename) {\n filename = config.build.outputFilename\n }\n const extName = extname(filename)\n if (extName !== '.js') {\n filename = filename.slice(0, -extName.length) + '.js'\n }\n if (config.script.lang == 'mcx') {\n entry = `${outputDir}/index.js`\n } else {\n entry = `${outputDir}/${filename}`\n }\n } else {\n entry = `${outputDir}/${config.script.main || 'index.js'}`\n const extName = extname(entry)\n if (extName !== '.js') {\n entry = entry.slice(0, -extName.length) + '.js'\n }\n }\n manifest.modules.push({\n type: 'script',\n entry: entry,\n language: 'javascript',\n uuid: fromString(hashRaw, BuildConfig.salt.sapi),\n description: `sapi generate by mbler, weclome to download and star at https://github.com/RuanhoR/mbler`,\n version: stringToNumberArray(config.version),\n })\n manifest.capabilities = ['script_eval']\n manifest.dependencies = [\n {\n module_name: '@minecraft/server',\n version: evalVersion(\n await Sapi.generateVersion(\n '@minecraft/server',\n config.mcVersion,\n config.script?.UseBeta || false,\n false\n )\n ), // only major.minor.patch, remove -beta or -rc\n },\n ]\n if (config.script.ui) {\n manifest.dependencies.push({\n module_name: '@minecraft/server-ui',\n version: evalVersion(\n await Sapi.generateVersion(\n '@minecraft/server-ui',\n config.mcVersion,\n config.script?.UseBeta || false,\n false\n )\n ), // only major.minor.patch, remove -beta or -rc\n })\n }\n }\n return manifest\n}\nexport default generateManifest\n","import { watch as chokidarWatch } from 'chokidar'\nimport * as fs from 'node:fs/promises'\nimport path, { isAbsolute } from 'node:path'\nimport {\n type Plugin,\n type RolldownLog,\n type RolldownWatcherEvent,\n type RolldownOptions,\n type RolldownBuild,\n type RolldownWatcher,\n} from 'rolldown'\nimport { onEnd } from '../commander'\nimport Logger from '../logger'\nimport type { ManifestData, MblerBuildConfig, MblerConfigData } from '../types'\nimport {\n fileExists,\n join,\n ReadProjectMblerConfig,\n showText,\n writeJSON,\n} from '../utils'\nimport { BuildConfig } from './config'\nimport { Progress } from './progress'\nimport type { CompileOpt } from '@mbler/mcx-types'\nimport { styleText } from 'node:util'\nimport type { LanguagePlugin } from '@volar/language-core'\nimport { BuildCacheManager } from './cache'\n\nclass Build {\n currentConfig: MblerConfigData | null = null\n srcDirs:\n | {\n [key in 'behavior' | 'resources']: string\n }\n | null = null\n outdirs:\n | {\n [key in 'behavior' | 'resources' | 'dist']: string\n }\n | null = null\n mcxLanguagePluginCreator:\n | ((ts: typeof import('typescript')) => LanguagePlugin<unknown>)\n | null = null\n constructor(\n config: MblerConfigData,\n private baseBuildDir: string,\n private resolve: (a: number) => void,\n private isWatch: boolean = false\n ) {\n this.currentConfig = config\n }\n /**\n * Start the watch mode.\n * This will perform an initial build (if not already done) and then\n * start filesystem and rollup watchers.\n * Returns the watcher handles once they are created so that callers\n * (for example tests) can clean them up later.\n */\n public async watch() {\n try {\n onEnd(() => {\n if (this.watchers) {\n this.watchers.chokidar.close()\n this.watchers.rollup?.close()\n }\n })\n await this._watch()\n } catch (e) {\n if (e instanceof Error) {\n Logger.e('Watcher', e.stack || e.message)\n } else {\n Logger.e('Watcher', e + '')\n }\n showText('MBLER__ERR__WATCHER: ' + e + ' Log at ' + Logger.LogFile)\n this.resolve(1)\n return null\n }\n }\n\n public async start() {\n try {\n return await this.build()\n } catch (e) {\n if (e instanceof Error) {\n Logger.e('Build', e.stack || e.message)\n } else {\n Logger.e('Build', e + '')\n }\n showText(\n 'MBLER__ERR__BUILD: ' + (e as Error).stack + ' Log at ' + Logger.LogFile\n )\n this.resolve(1)\n }\n }\n /**\n * Handles returned from the currently-active watchers.\n * Set by {@link createWatcher} and exposed via {@link getWatchers}\n * so that external callers can close them when necessary (e.g. tests).\n */\n private watchers: {\n rollup: RolldownWatcher | null\n chokidar: ReturnType<typeof chokidarWatch>\n } | null = null\n\n /**\n * Returns the watcher handles if watch mode has been started.\n * Can be safely called even before `watch()` has been invoked.\n */\n public getWatchers() {\n return this.watchers\n }\n\n /**\n * Close any active watchers. The build process does not automatically\n * terminate the watchers unless the process exits; tests or CLI wrappers\n * can call this method to clean up resources.\n */\n public closeWatchers() {\n if (this.watchers) {\n this.watchers.chokidar.close()\n this.watchers.rollup?.close()\n this.watchers = null\n }\n }\n private isDebug = process.env.DEBUG == 'true'\n private rollupPlugin: Plugin[] | null = null\n private cacheManager: BuildCacheManager | null = null\n public init: boolean = false\n private buildConfig: Partial<MblerBuildConfig> | null = null\n /**\n * Which modules are present in the current project.\n * - \"behavior\" when only behavior code exists\n * - \"resources\" when only resource files exist\n * - \"all\" when both are present\n * This field is populated during `handlerOtherAddon`.\n */\n public module: 'behavior' | 'resources' | 'all' | null = null\n /**\n * Determine whether a path refers to a regular file or a directory.\n * Follows symbolic links recursively. Throws if the path exists but\n * is not one of the expected types.\n *\n * @param filePath file system path to inspect\n * @returns \"file\" or \"directory\"\n */\n private async fileType(filePath: string): Promise<'file' | 'directory'> {\n const stat = await fs.lstat(filePath)\n if (stat.isFile()) {\n return 'file'\n }\n if (stat.isDirectory()) {\n return 'directory'\n }\n if (stat.isSymbolicLink()) {\n return await this.fileType(await fs.readlink(filePath))\n }\n throw new Error('[build addon]: invalid file type')\n }\n /**\n * Perform a single build of the project located at {@link baseBuildDir}.\n * The process is roughly:\n * 1. load and validate the configuration file\n * 2. prepare source and output directory information\n * 3. copy addon files (behavior/resources)\n * 4. generate manifest.json files\n * 5. run rollup to bundle any script entry point\n *\n * If anything goes wrong the promise returned by the public wrapper\n * (`build()` function exported at the bottom of this file) will be\n * resolved with a non-zero code and appropriate log entries will be\n * emitted.\n */\n private async build() {\n if (!this.currentConfig) {\n throw new TypeError('[mbler Builder]: cannot load config')\n }\n const buildStart = performance.now()\n const progress = new Progress(100)\n this.init = true\n if (!isAbsolute(this.baseBuildDir)) {\n throw new Error('[init build]: build dir is not absolute path')\n }\n // save user build config\n if (this.currentConfig.build) this.buildConfig = this.currentConfig.build\n // init cache\n this.cacheManager = new BuildCacheManager(\n this.baseBuildDir,\n this.buildConfig?.cache,\n this.buildConfig?.cachePath\n )\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: init cache: cache mode: ${this.cacheManager.getMode()}`\n )\n }\n // run onStart hook\n if (this.buildConfig?.onStart)\n await this.buildConfig.onStart(this.currentConfig)\n // load data\n this.loadData()\n // batch exec\n await Promise.all([\n () => {\n if (this.buildConfig?.clean !== false && this.outdirs) {\n return Promise.all([\n fs.rm(this.outdirs.behavior, { recursive: true, force: true }),\n fs.rm(this.outdirs.resources, { recursive: true, force: true }),\n ])\n }\n },\n this.handlerOtherAddon(),\n ])\n if (!this.isWatch) {\n progress.update(10)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 10%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n await this.handlerManifest()\n if (!this.isWatch) {\n progress.update(30)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 30%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n const isBundle = this.currentConfig.build?.bundle !== false\n\n if (this.currentConfig.script) {\n if (isBundle) {\n const rBuild = (await this.createRollup()) as RolldownBuild\n if (!this.rollupPlugin || !this.outdirs) {\n throw new Error(`[build addon]: rollup instance not available`)\n }\n if (!this.isWatch) {\n progress.update(50)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 50%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n // write script\n let output = this.currentConfig.script?.main\n if (!output) output = 'index.js'\n if (path.extname(output) !== 'js')\n output =\n output.slice(0, output.length - path.extname(output).length) + '.js'\n if (this.buildConfig?.outputFilename)\n output = this.buildConfig.outputFilename\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const writeOptions: Record<string, unknown> = {\n file: join(path.join(this.outdirs.behavior, outputDir), output),\n format: 'esm',\n sourcemap: false,\n }\n if (this.currentConfig.minify === 'oxc') {\n writeOptions.minify = true\n }\n await rBuild.write(writeOptions)\n } else {\n // bundle: false – skip rollup, copy source scripts directly\n const srcScriptDir = path.join(this.srcDirs!.behavior, 'scripts')\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const outPath = path.join(this.outdirs!.behavior, outputDir)\n if (await fileExists(srcScriptDir)) {\n await fs.cp(srcScriptDir, outPath, { recursive: true, force: true })\n }\n }\n }\n if (!this.isWatch) {\n progress.update(70)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 70%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n if (!this.outdirs || !this.module)\n throw new Error(`[build addon]: output directories not initialized`)\n if (process.env.BUILD_MODULE == 'release') {\n const generateRelease = require('./release').generateRelease\n await generateRelease({\n outdirs: this.outdirs,\n module: this.module,\n })\n }\n if (!this.isWatch) {\n progress.update(100)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build. build usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n if (!this.isWatch) {\n const elapsed = ((performance.now() - buildStart) / 1000).toFixed(2)\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('green', `✓ built in ${elapsed}s`)}`\n )\n this.resolve(0)\n }\n }\n /**\n * Create and return a Rollup build instance configured for the\n * project's script. The Rollup configuration mirrors the options\n * used by the CLI when running manual builds.\n *\n * Returns undefined if the project does not define a script section\n * (in which case nothing needs to be bundled).\n */\n private async createRollup() {\n if (!this.currentConfig || !this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n // no script handle\n if (!this.currentConfig.script) return\n // entry file path\n const main = path.join(\n this.srcDirs.behavior,\n 'scripts',\n this.currentConfig.script.main\n )\n if (!(await fileExists(main))) {\n throw new Error(`[build addon]: main script not found: ${main}`)\n }\n const plugin: Plugin[] = []\n // moduleDir\n const moduleDir = path.join(this.baseBuildDir, 'node_modules')\n if (!(await fileExists(moduleDir))) {\n throw new Error(`[build addon]: node_modules not found: ${moduleDir}`)\n }\n // handle minify option\n if (this.currentConfig.minify) {\n if (\n !['oxc', 'terser', 'esbuild', undefined].includes(\n this.currentConfig.minify\n )\n ) {\n throw new TypeError(\n 'ERR: [mbler]: mbler.config.js include invalid minify option: ' +\n this.currentConfig.minify\n )\n }\n if (this.currentConfig.minify === 'terser') {\n // terser (need install terser in user's project)\n plugin.push(require('./minify').terserPlugin(this.baseBuildDir))\n } else if (this.currentConfig.minify === 'esbuild') {\n // esbuild (need install esbuild in user's project)\n plugin.push(require('./minify').esbuildPlugin(this.baseBuildDir))\n }\n // (minify: oxc) handle at write option\n }\n if (this.buildConfig?.rollupPlugins) {\n // push user plugins\n plugin.push(...this.buildConfig.rollupPlugins)\n }\n if (this.currentConfig.script?.lang == 'mcx') {\n // mcx dsl plugin handle\n try {\n const tsconfigPath = path.join(this.baseBuildDir, 'tsconfig.json')\n if (!(await fileExists(tsconfigPath))) {\n throw new Error(\n `[build addon]: tsconfig.json not found: ${tsconfigPath}`\n )\n }\n const pluginConfig: CompileOpt = {\n moduleDir: moduleDir,\n tsconfigPath: tsconfigPath,\n sourcemap: false,\n ts: await import('typescript'),\n }\n if (this.mcxLanguagePluginCreator) {\n pluginConfig.mcxLanguagePlugin = this.mcxLanguagePluginCreator\n }\n const rolldownPlugin = require('@mbler/mcx-core').rolldownPlugin\n plugin.push(rolldownPlugin(pluginConfig, this.outdirs!))\n } catch (err) {\n throw new Error(\n `[build addon]: mcx plugin is required but '@mbler/mcx-core' could not be loaded: ${err}`,\n { cause: err }\n )\n }\n }\n // save plugin array for watcher re-use\n this.rollupPlugin = plugin\n const rollupOption: RolldownOptions = {\n input: main,\n external: [\n '@minecraft/server',\n '@minecraft/server-ui',\n ...(this.buildConfig?.rollupExternal ?? []),\n ],\n plugins: plugin,\n experimental: {\n ...(this.cacheManager?.shouldUseIncrementalBuild()\n ? { incrementalBuild: true }\n : {}),\n },\n }\n // push user hook\n if (this.buildConfig?.onWarn) {\n const onWarn: (\n warning: RolldownLog | string,\n defaultHandler: (warning: string | (() => string)) => void\n ) => void = (warning, _defaultHandler) => {\n const msg =\n typeof warning === 'string'\n ? warning\n : warning.message || 'Unknown warning'\n this.buildConfig?.onWarn?.(this.currentConfig!, new Error(msg))\n }\n rollupOption.onwarn = onWarn\n }\n if (this.buildConfig?.onEnd) {\n plugin.push({\n name: 'build-end-plugin',\n buildEnd: () => {\n return this.buildConfig?.onEnd?.(this.currentConfig!)\n },\n })\n }\n const buildBundle = require('rolldown').rolldown\n return await buildBundle(rollupOption)\n }\n\n /**\n * Internal helper invoked by {@link watch}.\n * Ensures a build has been run before starting the watchers.\n */\n private async _watch() {\n // init build\n if (!this.init) {\n await this.build()\n }\n await this.createWatcher()\n // watchers field is populated by createWatcher\n }\n\n private isParent(parent: string, dir: string): boolean {\n const relative = path.relative(parent, dir)\n return (\n !!relative && !relative.startsWith('..') && !path.isAbsolute(relative)\n )\n }\n\n private isChange<T extends object>(\n oldObj: T,\n newObj: T,\n checkKeys: Array<keyof T>\n ): boolean {\n for (const key of checkKeys) {\n if (\n typeof oldObj[key] === 'object' &&\n typeof newObj[key] === 'object' &&\n oldObj[key] !== null &&\n newObj[key] !== null\n ) {\n if (\n this.isChange(\n oldObj[key] as T,\n newObj[key] as T,\n Object.getOwnPropertyNames(oldObj[key]) as Array<\n keyof typeof oldObj\n >\n )\n ) {\n return true\n }\n } else if (oldObj[key] !== newObj[key]) {\n return true\n }\n }\n return false\n }\n\n private async createRollupWatcher() {\n if (\n !this.srcDirs ||\n !this.outdirs ||\n !this.currentConfig ||\n !this.rollupPlugin\n )\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n let output = this.currentConfig.script?.main\n if (!output) output = 'index.js'\n if (path.extname(output) !== 'js')\n output =\n output.slice(0, output.length - path.extname(output).length) + '.js'\n if (this.buildConfig?.outputFilename)\n output = this.buildConfig.outputFilename\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const outputOptions: Record<string, unknown> = {\n file: join(path.join(this.outdirs.behavior, outputDir), output),\n format: 'esm',\n sourcemap: false,\n }\n if (this.currentConfig.minify === 'oxc') {\n outputOptions.minify = true\n }\n const rolldownWatch = require('rolldown').watch\n const rollupWatcher = rolldownWatch({\n input: path.join(\n this.srcDirs.behavior,\n 'scripts',\n this.currentConfig?.script?.main || ''\n ),\n external: [\n '@minecraft/server',\n '@minecraft/server-ui',\n ...(this.buildConfig?.rollupExternal ?? []),\n ],\n plugins: this.rollupPlugin!,\n experimental: {\n ...(this.cacheManager?.shouldUseIncrementalBuild()\n ? { incrementalBuild: true }\n : {}),\n },\n output: outputOptions,\n watch: {\n clearScreen: false,\n include: path.join(this.srcDirs.behavior, 'scripts/**/*'),\n exclude: [\n path.join(this.baseBuildDir, 'node_modules/**/*'),\n this.outdirs.behavior,\n this.outdirs.resources,\n this.outdirs.dist,\n ],\n } as Record<string, unknown>,\n })\n rollupWatcher.on('change', async (filePath: string) => {\n Logger.i('Watcher', `file changed: ${filePath}, start rebuild`)\n })\n rollupWatcher.on('event', async (event: RolldownWatcherEvent) => {\n if (event.code === 'ERROR') {\n Logger.e('Watcher', `rollup error: ${event.error.stack || event.error}`)\n showText(\n 'MBLER__ERR__ROLLUP: ' +\n (event.error.stack || event.error) +\n ' Log at ' +\n Logger.LogFile\n )\n } else if (event.code === 'END') {\n Logger.i('Watcher', `rebuild success`)\n } else if (event.code === 'BUNDLE_END') {\n // rolldown handles incremental build internally\n }\n })\n return rollupWatcher\n }\n private async onChange(filePath: string) {\n const isBundle = this.currentConfig?.build?.bundle !== false\n if (\n !this.srcDirs ||\n !this.outdirs ||\n !this.currentConfig ||\n (isBundle && !this.rollupPlugin) ||\n !this.watchers\n )\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const isConfigChange =\n path.relative(\n path.join(this.baseBuildDir, BuildConfig.ConfigFile),\n filePath\n ) === ''\n const isPkgChange =\n path.relative(path.join(this.baseBuildDir, 'package.json'), filePath) ===\n ''\n const isScriptsChange =\n !isBundle &&\n this.isParent(path.join(this.srcDirs.behavior, 'scripts'), filePath)\n const isBehaviorChange =\n this.isParent(this.srcDirs.behavior, filePath) &&\n !this.isParent(path.join(this.srcDirs.behavior, 'scripts'), filePath)\n const isResourcesChange = this.isParent(this.srcDirs.resources, filePath)\n if (isConfigChange || isPkgChange) {\n const oldConfig = this.currentConfig\n Logger.i('Watcher', 'detected config change, reload config')\n this.currentConfig = await ReadProjectMblerConfig(this.baseBuildDir)\n this.buildConfig = this.currentConfig.build || null\n this.cacheManager = new BuildCacheManager(\n this.baseBuildDir,\n this.buildConfig?.cache,\n this.buildConfig?.cachePath\n )\n this.loadData()\n if (\n this.isChange(oldConfig, this.currentConfig, [\n 'name',\n 'version',\n 'description',\n 'mcVersion',\n ] as Array<keyof typeof oldConfig>)\n ) {\n await this.handlerManifest()\n }\n if (\n this.isChange(oldConfig, this.currentConfig, [\n 'script',\n 'outdir',\n 'build',\n ])\n ) {\n const newIsBundle = this.currentConfig.build?.bundle !== false\n if (newIsBundle && this.watchers.rollup) {\n this.watchers.rollup.close()\n await this.createRollup()\n this.watchers.rollup = await this.createRollupWatcher()\n } else if (newIsBundle) {\n await this.createRollup()\n this.watchers.rollup = await this.createRollupWatcher()\n } else {\n if (this.watchers.rollup) {\n this.watchers.rollup.close()\n }\n this.watchers.rollup = null\n }\n }\n }\n // if bundle: false and a script file changed, copy it directly\n if (isScriptsChange) {\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const relativePath = path.relative(\n path.join(this.srcDirs.behavior, 'scripts'),\n filePath\n )\n await fs.cp(\n filePath,\n path.join(this.outdirs.behavior, outputDir, relativePath),\n { recursive: true, force: true }\n )\n }\n // if behavior or resources change, we can just copy the changed file instead of copy all files again.\n if (isBehaviorChange || isResourcesChange) {\n const handlerBP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const relativePath = path.relative(this.srcDirs.behavior, filePath)\n await fs.cp(\n path.join(this.srcDirs.behavior, relativePath),\n path.join(this.outdirs.behavior, relativePath),\n {\n recursive: true,\n force: true,\n }\n )\n }\n const handlerRP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const relativePath = path.relative(this.srcDirs.resources, filePath)\n await fs.cp(\n path.join(this.srcDirs.resources, relativePath),\n path.join(this.outdirs.resources, relativePath),\n {\n recursive: true,\n force: true,\n }\n )\n }\n if (isBehaviorChange) {\n await handlerBP()\n }\n if (isResourcesChange) {\n await handlerRP()\n }\n }\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('bgYellow', `file changed: ${filePath}`)}`\n )\n }\n\n private async createWatcher() {\n const isBundle = this.currentConfig?.build?.bundle !== false\n if (!this.srcDirs || !this.outdirs || (isBundle && !this.rollupPlugin))\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const chokidar = chokidarWatch(this.baseBuildDir, {\n ignored: [\n this.outdirs.behavior,\n this.outdirs.resources,\n this.outdirs.dist,\n path.join(this.baseBuildDir, 'node_modules'),\n ],\n ignoreInitial: true,\n interval: 100,\n })\n const onChange = async (filePath: string) => {\n await this.onChange(filePath)\n }\n chokidar.on('change', onChange)\n if (isBundle && this.currentConfig?.script) {\n const rollupWatcher = await this.createRollupWatcher()\n this.watchers = {\n chokidar,\n rollup: rollupWatcher,\n }\n } else {\n this.watchers = {\n chokidar,\n rollup: null,\n }\n }\n }\n\n private async handlerManifest() {\n if (!this.currentConfig || !this.outdirs || !this.srcDirs || !this.module)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const otherManifestOption: {\n behavior: ManifestData\n resources: ManifestData\n } = {\n behavior: {} as ManifestData,\n resources: {} as ManifestData,\n }\n const generateManifest = require('./manifest').default\n const loadOtherManifest = async (moduleType: 'behavior' | 'resources') => {\n const filePath = path.join(this.srcDirs![moduleType], 'manifest.json')\n if (await fileExists(filePath)) {\n try {\n const content = await fs.readFile(filePath, 'utf-8')\n return JSON.parse(content) as ManifestData\n } catch (_err) {\n Logger.w('Build', `invalid manifest.json in ${moduleType}`)\n }\n }\n return {} as ManifestData\n }\n const tasks: Promise<void>[] = []\n if (this.module == 'behavior' || this.module == 'all') {\n tasks.push(\n (async () => {\n otherManifestOption.behavior = await loadOtherManifest('behavior')\n const manifest = await generateManifest(this.currentConfig!, 'data')\n await writeJSON(path.join(this.outdirs!.behavior, 'manifest.json'), {\n ...manifest,\n ...otherManifestOption.behavior,\n })\n })()\n )\n }\n if (this.module == 'resources' || this.module == 'all') {\n tasks.push(\n (async () => {\n otherManifestOption.resources = await loadOtherManifest('resources')\n const manifest = await generateManifest(\n this.currentConfig!,\n 'resources'\n )\n await writeJSON(path.join(this.outdirs!.resources, 'manifest.json'), {\n ...manifest,\n ...otherManifestOption.resources,\n })\n })()\n )\n }\n await Promise.all(tasks)\n }\n\n private loadData() {\n // check run time\n if (!this.currentConfig || !this.baseBuildDir)\n throw new Error('[build data]: already initialized')\n // source code dir\n this.srcDirs = {\n behavior: path.join(this.baseBuildDir, BuildConfig.behavior),\n resources: path.join(this.baseBuildDir, BuildConfig.resources), // res\n }\n // output dir\n this.outdirs = {\n behavior: this.currentConfig.outdir?.behavior\n ? join(this.baseBuildDir, this.currentConfig.outdir.behavior)\n : path.join(this.baseBuildDir, 'dist/dep'),\n resources: this.currentConfig.outdir?.resources\n ? join(this.baseBuildDir, this.currentConfig.outdir.resources)\n : path.join(this.baseBuildDir, 'dist/res'),\n dist: this.currentConfig.outdir?.dist\n ? join(this.baseBuildDir, this.currentConfig.outdir.dist)\n : path.join(this.baseBuildDir, 'dist-pkg'),\n }\n }\n\n /**\n * Copy the various files (behavior/resources) into the corresponding\n * output directories and determine which modules exist in the project\n * by inspecting the source directories.\n */\n private async handlerOtherAddon() {\n if (!this.srcDirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n const isHasBp = await fileExists(this.srcDirs.behavior)\n if (!isHasBp)\n throw new Error('[build addon]: behavior source directory not found')\n // init copy resources\n const handlerBP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n for (const f of await fs.readdir(this.srcDirs.behavior)) {\n const fType = await this.fileType(path.join(this.srcDirs.behavior, f))\n const includeType =\n BuildConfig.includes.behavior[f] || BuildConfig.includes.public[f]\n if (includeType == fType) {\n await fs.cp(\n path.join(this.srcDirs.behavior, f),\n path.join(this.outdirs.behavior, f),\n {\n recursive: true,\n force: true,\n }\n )\n } else if (includeType == 'skip') {\n continue\n } else {\n throw new Error(\n `[build addon]: invalid file: ${path.join(this.srcDirs.behavior, f)}: type: ${fType}`\n )\n }\n }\n }\n const handlerRP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n for (const f of await fs.readdir(this.srcDirs.resources)) {\n const fType = await this.fileType(path.join(this.srcDirs.resources, f))\n const includeType =\n BuildConfig.includes.resources[f] || BuildConfig.includes.public[f]\n if (includeType == fType) {\n await fs.cp(\n path.join(this.srcDirs.resources, f),\n path.join(this.outdirs.resources, f),\n {\n recursive: true,\n force: true,\n }\n )\n } else if (includeType == 'skip') {\n continue\n } else {\n throw new Error(\n `[build addon]: invalid file: ${path.join(this.srcDirs.resources, f)}: type: ${fType}`\n )\n }\n }\n }\n const tasks: Promise<void>[] = []\n if (await fileExists(this.srcDirs.behavior)) {\n this.module = 'behavior'\n tasks.push(handlerBP())\n }\n if (await fileExists(this.srcDirs.resources)) {\n if (this.module == 'behavior') {\n this.module = 'all'\n } else {\n this.module = 'resources'\n }\n tasks.push(handlerRP())\n }\n if (!this.module) {\n throw new Error(\n \"[build addon]: couldn't resolve source code (your behavior or resources code is not found)\"\n )\n }\n await Promise.all(tasks)\n }\n}\nfunction build(config: MblerConfigData, work: string): Promise<number> {\n return new Promise<number>((resolve) => {\n new Build(config, work, resolve).start()\n })\n}\nfunction watch(config: MblerConfigData, work: string): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n try {\n const build = new Build(config, work, resolve, true)\n build.start().then(() => {\n build.watch()\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('bgYellow', 'watching for file changes...')}`\n )\n })\n } catch (err) {\n if (err instanceof Error) {\n reject(`[watcher]: error ${err.stack || err.message}`)\n } else {\n reject(err)\n }\n }\n })\n}\nexport { build, watch }\nexport default Build\nexport { Build }\nexport { default as Sapi } from './sapi'\nexport { default as McxTsc } from './plugin-mcx-tsc'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEa,gBAAgB,CAAC,MAAM,KAAK;CAC5B,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAuIY,sBAAuC;EAClD,MAAM;EACN,aAAa;EACb,aAAa;EACb,SAAS;EACT,WAAW;EACX,QAAQ;EACR,QAAQ,EACN,MAAM,IACP;EACD,QAAQ;GACN,UAAU;GACV,WAAW;GACX,MAAM;GACP;EACD,OAAO;GACL,eAAe,EAAE;GACjB,OAAO;GACP,QAAQ;GACR,WAAW;GACX,gBAAgB;GAChB,aAAa;GACb,eAAe;GACf,cAAc;GACf;EACF;;;;;;mBCvLc;EAAE,QAAQ;;;;;;EAKtB,SAAS;;;;;;;aCLgC;eACZ;cAEjB;EACb,aAAa;;;;OAIR,QAAQ,KAAK,KAAK,CAAC;;;;;;;EAOxB,MAAM;GACJ,MAAM;GACN,MAAM;GACN,GAAG;GACH,MAAM;GACN,GAAG;GACH,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO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;GACN,MAAM;GACN,GAAG;GACH,MAAM;GACN,GAAG;GACH,MAAM;GACN,OAAO;GACP,GAAG;GACH,KAAK;GACL,OACE;GACF,MAAM;GACN,SACE;GACF,gBACE;GACF,SACE;GACF,WACE;GACF,SACE;GACF,WACE;GACF,OAAO;GACP,SAAS;GACT,MAAM;GACN,QACE;GACH;EACD,MAAM;GACJ,OAAO;GACP,QAAQ;GACR,MAAM;GACN,aAAa;GACb,SAAS;GACT,SACE,wEACAC,gBAAQ;GACV,MAAM;GACN,SAAS;GACT,WAAW;GACX,YAAY;GACZ,aAAa;GACb,QAAQ;GACT;EACD,SAAS;GACP,YAAY;GACZ,OAAO;GACR;EACD,SAAS;GACP,KAAK;GACL,QAAQ;GACR,UAAU;GACV,SAAS;GACT,cAAc;GACf;EACD,SAAS;GACP,QACE;GACF,aAAa;GACb,UAAU;GACV,eAAe;GACf,YAAY;GACZ,UAAU;GACV,iBAAiB;GACjB,gBAAgB;GAChB,eAAe;GACf,qBAAqB;GACrB,gBAAgB;GAChB,gBAAgB;GAChB,gBAAgB;GAChB,iBAAiB;GACjB,oBAAoB;GACpB,cAAc;GACd,eAAe;GACf,cAAc;GACd,oBAAoB;GACpB,qBAAqB;GACrB,iBAAiB;GACjB,qBAAqB;GACrB,eAAe;GACf,aAAa;GACd;EACD,SAAS;GACP,qBACE;GACF,qBACE;GACF,YAAY;GACZ,iBAAiB;GACjB,WAAW;GACX,aAAa;GACb,cAAc;GACd,SAAS;GACT,QAAQ;GACT;EACD,WAAW;GACT,SAAS;GACT,QAAQ;GACT;EACD,WAAW;GACT,SAAS;GACT,QAAQ;GACT;EACD,MAAM;GACJ,OAAO;GACP,iBAAiB;GACjB,OAAO;GACP,aAAa;GACb,QAAQ;GACT;EACD,QAAQ;GACN,OACE;GACF,YAAY;GACZ,WAAW;GACX,YAAY;GACZ,UAAU;GACV,iBAAiB;GACjB,gBAAgB;GAChB,QAAQ;GACT;EACD,WAAW,EACT,WAAW,0CACZ;EACF;;;;AC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AAS,QAAQ,CAAC,IAAI,UAAU,YAAY,+BAA+B,GAC1F;KACD;WACK,KAAK;GACZ,IAAI,eAAe,OACjB,OAAO,oBAAoB,IAAI,SAAS,IAAI,UAAU;QAEtD,OAAO,IAAI;;GAGf"}
|
|
1
|
+
{"version":3,"file":"build.esm.mjs","names":["version","version","fs","ZhLang","enLang","fileExists","path","fs","path","path","fs","Sapi","fs","chokidarWatch"],"sources":["../src/types.ts","../src/version.ts","../src/i18n/zh.ts","../src/i18n/en.ts","../src/i18n/index.ts","../src/commander/index.ts","../src/logger/index.ts","../src/build/config.ts","../src/utils/index.ts","../src/build/progress.ts","../src/build/cache.ts","../src/config.ts","../src/build/sapi.ts","../src/build/plugin-mcx-tsc.ts","../src/build/release.ts","../src/build/minify.ts","../src/uuid/index.ts","../src/build/manifest.ts","../src/build/index.ts"],"sourcesContent":["import { Plugin } from 'rolldown'\n\nexport const LanguageNames = ['zh', 'en']\nexport const cmdList = [\n 'c',\n 'work',\n 'help',\n 'h',\n 'init',\n 'version',\n 'build',\n 'watch',\n 'lang',\n 'set-work-dir',\n 'publish',\n 'unpublish',\n 'install',\n 'uninstall',\n 'login',\n 'profile',\n 'log',\n 'view',\n 'config',\n] as const\ntype HelpCommand = (typeof cmdList)[number]\nexport interface language {\n description: string\n help: {\n cmds: readonly string[]\n } & {\n [K in HelpCommand]: string\n }\n default: {\n unexpected: string\n youis: string\n }\n workdir: {\n set: string\n nfound: string\n disabled: string\n enabled: string\n invalidParam: string\n }\n init: {\n initDes: string\n name: string\n description: string\n useGIT: string\n useUI: string\n lang: string\n betaApi: string\n mcVersion: string\n noName: string\n noMCVersion: string\n noLanguare: string\n welcome: string\n }\n publish: {\n askTip: string\n notLoggedIn: string\n progress: string\n publishFailed: string\n publishing: string\n building: string\n publishToMarket: string\n publishSuccess: string\n publishResult: string\n projectPathNotExist: string\n outdirNotFound: string\n outdirNotExist: string\n readmeNotFound: string\n metadataInvalid: string\n packageNameInvalid: string\n nameMismatch: string\n notLoginError: string\n tokenMissing: string\n unpublishReqFailed: string\n createSessionFailed: string\n uploadZipFailed: string\n packageJsonNotFound: string\n noBuildScript: string\n buildFailed: string\n }\n install: {\n failedNoPackageJson: string\n failedNoBuildScript: string\n installing: string\n packageNotFound: string\n noVersion: string\n usingLatest: string\n noValidAddon: string\n success: string\n failed: string\n }\n uninstall: {\n success: string\n failed: string\n }\n unpublish: {\n success: string\n failed: string\n }\n view: {\n usage: string\n packageNotFound: string\n title: string\n versionLine: string\n failed: string\n }\n config: {\n usage: string\n missingArg: string\n getResult: string\n setSuccess: string\n pointGet: string\n pointSetSuccess: string\n pointSetFailed: string\n failed: string\n }\n commander: {\n selectTip: string\n }\n}\nexport interface MblerConfigScript {\n ui?: boolean // use minecraft module \"@minecraft/server-ui\"\n lang?: 'ts' | 'mcx' | 'js' // languare\n main: string // main file point(start <project>/behavior), be like: index.js\n UseBeta?: boolean // use beta minecraft api\n}\nexport interface MblerConfigOutdir {\n behavior?: string // behavior output dir, default: ./dist/dep\n resources?: string // resources output dir, default: ./dist/res\n dist: string // build use \"-dist\" option to build to a mcaddon file.\n}\nexport interface MblerBuildConfig {\n rollupPlugins: Plugin[]\n rollupExternal: string[]\n cache: 'none' | 'memory' | 'file' | 'filesystem' | 'auto'\n cachePath: string\n bundle: boolean\n clean?: boolean\n outputDir: string\n outputFilename: string\n onEnd: (ctx: MblerConfigData) => void | Promise<void>\n onStart: (ctx: MblerConfigData) => void | Promise<void>\n onWarn: (ctx: MblerConfigData, warning: Error) => void | Promise<void>\n}\nexport interface MblerConfigData {\n name: string // addon name (package scope, e.g. \"@scope/name\")\n displayName?: string // display name shown in manifest (falls back to name)\n outdir?: MblerConfigOutdir // output\n description: string // addon description\n version: string // version, like be \"0.0.1-beta\"\n mcVersion: string // use mcVersion, be like \"1.21.100\"\n script?: MblerConfigScript // sapi option\n minify?: 'oxc' | 'terser' | 'esbuild' // use minify\n build?: Partial<MblerBuildConfig> // build config\n}\nexport const templateMblerConfig: MblerConfigData = {\n name: 'demo',\n displayName: '',\n description: 'demo',\n version: '0.0.0',\n mcVersion: '1.21.100',\n minify: 'oxc',\n script: {\n main: '',\n },\n outdir: {\n behavior: '',\n resources: '',\n dist: '',\n },\n build: {\n rollupPlugins: [],\n cache: 'auto',\n bundle: true,\n outputDir: 'scripts',\n outputFilename: '',\n onEnd: () => {},\n onStart: () => {},\n onWarn: () => {},\n },\n}\nexport interface CliParam {\n params: string[]\n opts: Record<string, string>\n}\nexport interface ManifestData {\n format_version: number\n header: {\n name: string\n description: string\n uuid: string\n version: number[]\n min_engine_version: number[]\n }\n modules: Array<{\n type: 'script' | 'data' | 'resources'\n uuid: string\n description?: string\n version: number[]\n language?: string\n entry?: string\n }>\n dependencies?: Array<{\n module_name: string\n version: string\n }>\n subpack?: Array<{\n folder_name: string\n name: string\n memory_tier: number\n }>\n capabilities?: string[]\n}\nexport interface npmFetchData {\n name: string\n 'dist-tags': Record<string, string>\n versions: Record<\n string,\n {\n maintainers: {\n name: string\n mail: string\n }[]\n dist: {\n shasum: string\n tarball: string\n }\n author: {\n name: string\n mail: string\n }\n license: string\n version: string\n }\n >\n readme: string\n keywords: string[]\n homepage: string\n time: Record<string, string>\n}\nexport interface PMNXProfile {\n mail: string\n name: string\n uid: number\n avatar_url?: string\n ctime: string\n}\n\nexport interface PublishMetadata {\n readme: string\n scope: string\n name: string\n version: string\n version_tag: string\n}\nexport interface MNXPackageInfoResult {\n id: string\n readmeTable: [number, string][]\n versions: {\n download_url: string\n version_tag: string\n name: string\n create_user: PMNXProfile\n readme: number\n create_time: string // ISO Date string\n }[]\n download: number /**下载量 */\n}\nexport interface BaseResult {\n code: 200 | -1\n message: string\n success: boolean\n}\nexport interface MNXPackageVersionInfoResult {\n id: string\n versions: {\n download_url: string\n version_tag: string\n name: string\n create_user: PMNXProfile\n readme: string\n create_time: string // ISO Date string\n }\n}\n","export default { commit: `commit 97de736362daf4fa8f657d93e6c04ed75100f835\nAuthor: ruanhor <3915264929@qq.com>\nDate: Sun Jun 28 11:23:01 2026 +0800\n\n chore: update @mbler/mcx-server dep to ^0.1.2-rc.1\n`, version: \"0.2.8-rc.7\" }","import { cmdList, language } from '../types'\nimport version from '../version'\n\nexport default {\n description: `MBLER\nMinecraft Bedrock Edition\nAddon Bulider In Nodejs\n在基岩版我的世界上的 nodejs 构建工具\n命令 : ${cmdList.join(', ')}\n帮助命令 : \n help\n 显示帮助信息\n 第二个参数为要查询的命令名称或空\n 别名: h\ngit https://github.com/RuanhoR/mbler/`,\n help: {\n cmds: cmdList,\n help: 'mbler [help/h] [?:查看的命令名称]\\n - 查看帮助',\n h: '$help',\n work: 'mbler [work/c] [?:相对或绝对路径]\\n - 没有输入路径:查询当前工作目录\\n - 输入路径:设置工作目录',\n c: '$work',\n init: 'mbler init\\n - 初始化当前工作目录,可使用 mbler work 指定工作目录或使用参数一次确定(例: mbler init -in ./)\\n - 将会询问选项以完成初始化',\n build: 'mbler build\\n - 在工作目录执行构建',\n log: 'mbler log\\n - 处理日志文件\\n - mbler log point: 得到日志文件路径 \\n - mbler log clean: 清除日志',\n watch: 'mbler watch\\n - 启动构建并开启监视模式,文件变化会自动重新构建',\n lang: 'mbler lang\\n- 无参数:显示当前语言\\n- 跟 zh 或 en(如 mbler lang en): 设置语言',\n version:\n 'mbler version - 版本管理命令\\n- 无参数:显示当前版本和提交哈希\\n- --show=<commit|version>:筛选显示内容\\n- <新版本号>:更新package.json和配置文件的版本',\n 'set-work-dir':\n 'mbler set-work-dir <on|off>\\n - on: 启用工作目录功能\\n - off: 禁用工作目录功能,直接使用 process.cwd()',\n publish:\n 'mbler publish\\n - 将你的附加包发布到 pmnx\\n- 参数:\\n- -tag: 版本标签名称\\n- -build <skip|always>: 是否跳过构建(默认 always)',\n uninstall:\n 'mbler uninstall @<scope>/<name>@version\\n从你的游戏中移除一个包',\n install: 'mbler install @<scope>/<name>@version\\n将一个包安装到你的游戏中',\n unpublish:\n 'mbler unpublish @<scope>/<name>@version\\n从 pmnx 取消发布一个包',\n login:\n 'mbler login <?:token>\\n使用 token 登录你的 pmnx 账户\\n- 如果没有 token,会向你请求',\n profile: 'mbler profile\\n显示当前登录账户信息',\n view: 'mbler view @<scope>/<name>\\n查看包的版本列表',\n config:\n 'mbler config get <key>\\nmbler config set <key> <value>\\nmbler config point <path>\\nmbler config point get',\n },\n init: {\n useUI: '使用UI模块? (y/n): ',\n useGIT: '初始化GIT仓库? (y/n): ',\n name: '项目名称: ',\n welcome:\n '欢迎使用Mbler初始化向导 语言:中文 mbler 版本: ' + version.version,\n description: '项目描述: ',\n initDes: '初始化依赖? (y/n): ',\n lang: '选择项目语言: ',\n betaApi: '使用Beta Api? (y/n): ',\n mcVersion: '项目使用的mc版本(x.x.x): ',\n noLanguare: '没有输入项目语言,这是必要的',\n noName: '没有项目名称,这是必要的',\n noMCVersion: \"输入的 '支持的mc版本' 格式不对\",\n },\n default: {\n unexpected: '不正确的命令,',\n youis: '你是否想说: ',\n },\n workdir: {\n set: '[工作目录] 设置为: ',\n nfound: '找不到输入文件夹(无法创建或不是文件夹)',\n disabled: '工作目录功能已禁用,将使用当前目录',\n enabled: '工作目录功能已启用',\n invalidParam: '参数错误,请使用 on 或 off',\n },\n publish: {\n askTip:\n '输入MCBE游戏绝对目录 (如 /sdcard/Android/data/com.mojang.minecraftpe/files/games),以进行下一步: ',\n notLoggedIn: '未登录,请先执行 `mbler login <token>`',\n progress: '进度: {progress}%',\n publishFailed: '发布失败: {error}',\n publishing: '正在发布...',\n building: '正在构建项目...',\n publishToMarket: '正在上传到市场...',\n publishSuccess: '发布成功',\n publishResult: '+ {name}@{version} ({tag})',\n projectPathNotExist: '项目路径不存在',\n outdirNotFound: '未找到构建输出目录配置',\n outdirNotExist: '构建输出目录不存在',\n readmeNotFound: '未找到 README 文件',\n metadataInvalid: '元数据无效',\n packageNameInvalid: '包名格式必须是 @scope/name',\n nameMismatch: 'mbler.config.js 与 package.json 中的 name 必须一致',\n notLoginError: '未登录',\n tokenMissing: '获取 token 失败',\n unpublishReqFailed: '取消发布请求失败',\n createSessionFailed: '创建发布会话失败',\n uploadZipFailed: '上传 zip 文件失败',\n packageJsonNotFound: '未找到 package.json',\n noBuildScript: 'package.json 中未找到 build 脚本',\n buildFailed: '构建失败,退出码: {code}',\n },\n install: {\n failedNoPackageJson: '安装失败:工作目录必须包含 package.json',\n failedNoBuildScript: '安装失败:package.json 必须包含 build 脚本',\n installing: '正在安装包 {pkg}...',\n packageNotFound: '未找到包 {pkg}',\n noVersion: '包 {pkg} 没有可用版本',\n usingLatest: '使用最新版本 {version}',\n noValidAddon: '包内未找到有效 addon',\n success: '包 {pkg}@{version} 已安装为 {id}',\n failed: '安装失败: {error}',\n },\n uninstall: {\n success: '包 {pkg}@{version} 卸载成功',\n failed: '卸载失败: {error}',\n },\n unpublish: {\n success: '包 {pkg}@{version} 取消发布成功',\n failed: '取消发布失败: {error}',\n },\n view: {\n usage: 'mbler view @<scope>/<name>',\n packageNotFound: '未找到包 {pkg}',\n title: '包 {pkg} 版本列表:',\n versionLine: '- {version} [{tag}] by {user} at {time}',\n failed: '查看失败: {error}',\n },\n config: {\n usage:\n 'mbler config get <key> | set <key> <value> | point <path> | point get',\n missingArg: '参数不足',\n getResult: '{key} = {value}',\n setSuccess: '已设置 {key} = {value}',\n pointGet: '当前配置文件: {path}',\n pointSetSuccess: '配置文件指向已设置为: {path}',\n pointSetFailed: '配置文件指向设置失败: {error}',\n failed: '配置操作失败: {error}',\n },\n commander: {\n selectTip: '(按 b 确认,n 键选择下一个)',\n },\n} as language\n","import { cmdList, language } from '../types'\nimport version from '../version'\n\nexport default {\n description:\n 'MBLER\\nMinecraft Bedrock Edition\\nAddon Bulider In Nodejs\\nnodejs build tools on bedrock version of minecraft\\nCommands: ' +\n cmdList.join(', ') +\n '\\nHelp command:\\n help\\n Show help information\\n The second parameter is the name of the command to be queried or empty\\n Alias: -h, -help\\n git https://github.com/RuanhoR/mbler/',\n help: {\n cmds: cmdList,\n help: 'mbler [help/h] [?: command name]\\n - see tip',\n h: '$help',\n work: 'mbler [work/c] [?: path]\\n - No input path: see current work dir\\n - input path: set as current dir',\n c: '$work',\n init: 'mbler init\\n - Init current work dir, you can use `mbler work` command or use command param(like be: mbler init -in ./)',\n build: 'mbler build\\n - perform a build using the library API',\n b: '$build',\n log: 'mbler log\\n - Handler log file\\n - mbler log point: Get log file path \\n - mbler log clean: Remove Log',\n watch:\n 'mbler watch\\n - run build and enter watch mode; changes will trigger rebuilds',\n lang: 'mbler lang [?:language]\\n- No args: show current language\\n- language = \"zh” | “en\": set language',\n version:\n 'mbler version\\n - Version control command\\n- No args: Shows version + commit hash\\n- --show=<commit|version>: Filters output\\n- <new_version>: Updates version in both package.json and config file',\n 'set-work-dir':\n 'mbler set-work-dir <on|off>\\n - on: Enable work dir feature\\n - off: Disable work dir feature, use process.cwd() directly',\n publish:\n 'mbler publish\\n - Publish your package to pmnx\\n- Params:\\n- -tag: version tag name\\n- -build <skip|always>: skip or run build before publish (default: always)',\n uninstall:\n 'mbler uninstall @<scope>/<name>@version\\nRemove a package from your game',\n install:\n 'mbler install @<scope>/<name>@version\\nInstall a package to your game',\n unpublish:\n 'mbler unpublish @<scope>/<name>@version\\nUnpublish a package from pmnx',\n login: 'mbler login <?:token>\\nUse token login your pmnx account',\n profile: 'mbler profile\\nShow current logged-in account profile',\n view: 'mbler view @<scope>/<name>\\nShow package versions',\n config:\n 'mbler config get <key>\\nmbler config set <key> <value>\\nmbler config point <path>\\nmbler config point get',\n },\n init: {\n useUI: 'Use UI? (y/n): ',\n useGIT: 'Initialize GIT repository? (y/n): ',\n name: 'Project name: ',\n description: 'Project description: ',\n initDes: 'Initialize dependencies? (y/n): ',\n welcome:\n 'Welcome to use Mbler init wizard! Language: English mbler version: ' +\n version.version,\n lang: 'Project language: ',\n betaApi: 'use beta api(y/n): ',\n mcVersion: 'Minecraft version(be like: x.x.x): ',\n noLanguare: 'project language is required',\n noMCVersion: 'project mcVersion format is not right',\n noName: 'project name is required',\n },\n default: {\n unexpected: 'Not found this command,',\n youis: 'You want to input: ',\n },\n workdir: {\n set: '[path to]: ',\n nfound: \"not found this dir(can't create or not directory)\",\n disabled: 'Work dir disabled, will use current directory',\n enabled: 'Work dir enabled',\n invalidParam: 'Invalid parameter, use on or off',\n },\n publish: {\n askTip:\n 'Plase input the absolute path of your MCBE game directory (like /sdcard/Android/data/com.mojang.minecraftpe/files/games) for next step: ',\n notLoggedIn: 'Not logged in. Use `mbler login <token>` first.',\n progress: 'Progress: {progress}%',\n publishFailed: 'Publish failed: {error}',\n publishing: 'Publishing...',\n building: 'Building project...',\n publishToMarket: 'Publishing to marketplace...',\n publishSuccess: 'Publish successful',\n publishResult: '+ {name}@{version} ({tag})',\n projectPathNotExist: 'Project path does not exist',\n outdirNotFound: 'Build output directories not found',\n outdirNotExist: 'Build output directories do not exist',\n readmeNotFound: 'README file not found',\n metadataInvalid: 'Invalid metadata',\n packageNameInvalid: 'Package name must be in the format of @scope/name',\n nameMismatch: 'Package name in mbler.config.js and package.json must match',\n notLoginError: 'Not logged in',\n tokenMissing: 'Failed to get token',\n unpublishReqFailed: 'Failed to unpublish package',\n createSessionFailed: 'Failed to create publish session',\n uploadZipFailed: 'Failed to upload zip file',\n packageJsonNotFound: 'package.json not found',\n noBuildScript: 'No build script found in package.json',\n buildFailed: 'Build failed with code {code}',\n },\n install: {\n failedNoPackageJson:\n 'Install failed: work directory must contain package.json',\n failedNoBuildScript:\n 'Install failed: package.json must contain a build script',\n installing: 'Installing package {pkg}...',\n packageNotFound: 'Package {pkg} not found',\n noVersion: 'Package {pkg} has no available version',\n usingLatest: 'Using latest version {version}',\n noValidAddon: 'No valid addon found in package',\n success: 'Package {pkg}@{version} installed successfully as {id}',\n failed: 'Install failed: {error}',\n },\n uninstall: {\n success: 'Package {pkg}@{version} uninstalled successfully',\n failed: 'Uninstall failed: {error}',\n },\n unpublish: {\n success: 'Package {pkg}@{version} unpublished successfully',\n failed: 'Unpublish failed: {error}',\n },\n view: {\n usage: 'mbler view @<scope>/<name>',\n packageNotFound: 'Package {pkg} not found',\n title: 'Package {pkg} versions:',\n versionLine: '- {version} [{tag}] by {user} at {time}',\n failed: 'View failed: {error}',\n },\n config: {\n usage:\n 'mbler config get <key> | set <key> <value> | point <path> | point get',\n missingArg: 'Missing argument',\n getResult: '{key} = {value}',\n setSuccess: 'Set {key} = {value}',\n pointGet: 'Current config file: {path}',\n pointSetSuccess: 'Config file pointer set to: {path}',\n pointSetFailed: 'Failed to set config pointer: {error}',\n failed: 'Config command failed: {error}',\n },\n commander: {\n selectTip: '(Press b to confirm, n to select next)',\n },\n} as language\n","import fs from 'node:fs'\nimport ZhLang from './zh.js'\nimport enLang from './en.js'\nimport path from 'node:path'\nimport { language, LanguageNames } from '../types.js'\nimport { homedir } from 'node:os'\nconst configPath = path.join(\n homedir(), // ~/.cache/mbler/lang.db: push language config\n '.cache/mbler/lang.db'\n)\nfunction isLanguageName(\n language: string\n): language is (typeof LanguageNames)[number] {\n return LanguageNames.includes(language)\n}\nclass Lang {\n currentLang: (typeof LanguageNames)[number] = 'zh'\n init() {\n try {\n const TheyLang = fs.readFileSync(configPath, 'utf-8').toString().trim()\n if (isLanguageName(TheyLang)) {\n this.currentLang = TheyLang\n } else {\n throw new Error('[setup lang]: set lang error')\n }\n } catch {\n this.currentLang = 'zh'\n }\n }\n set(newLang: (typeof LanguageNames)[number]) {\n if (LanguageNames.includes(newLang)) {\n if (!fs.existsSync(configPath)) {\n fs.mkdirSync(path.dirname(configPath), {\n recursive: true,\n })\n }\n fs.writeFileSync(configPath, newLang)\n this.currentLang = newLang\n return true\n }\n return false\n }\n get() {\n try {\n if (this.currentLang == 'zh') return ZhLang\n return enLang\n } catch {\n return ZhLang\n }\n }\n}\ninterface lang extends language {\n __internal: {\n class: Lang\n set: (newLang: (typeof LanguageNames)[number]) => void\n }\n}\nconst lang = new Lang()\nconst i18n: lang = {} as unknown as lang\nfunction Export(lang: Lang) {\n const obj = lang.get()\n Object.setPrototypeOf(i18n, {\n ...obj,\n __internal: {\n class: lang,\n set: (newLang: (typeof LanguageNames)[number]) => {\n lang.set(newLang)\n Export(lang)\n },\n },\n })\n}\n\nlang.init()\nExport(lang)\nexport default i18n\n","import * as readline from 'readline'\nimport i18n from '../i18n/index.js'\nif (process.stdin.isTTY) {\n process.stdin.setRawMode(true)\n readline.emitKeypressEvents(process.stdin)\n}\ninterface KeyPromise {\n name: string\n ctrl: boolean\n alt: boolean\n resolve: () => void\n}\n\nconst promises: KeyPromise[] = []\nconst tasks: Array<\n (name: string, ctrl: boolean, alt: boolean, raw: string) => void\n> = []\nprocess.on('exit', (_code) => {\n process.stdout.write('\\x1b[?25h')\n})\nconst endTasks: (() => void)[] = []\nexport function onEnd(task: () => void) {\n endTasks.push(task)\n}\nclick('c', {\n ctrl: true,\n}).then(() => {\n endTasks.forEach((task) => task())\n process.exit(0)\n})\nfunction handler(\n name: string,\n {\n ctrl,\n alt,\n }: {\n ctrl: boolean\n alt: boolean\n },\n raw: string\n) {\n const find = promises.find(\n (e) => e.name === name && e.ctrl === ctrl && e.alt === alt\n )\n if (find) {\n find.resolve()\n promises.splice(promises.indexOf(find), 1)\n }\n tasks.forEach((item) => item(name, ctrl, alt, raw))\n}\nexport function click(\n name: string,\n {\n ctrl = false,\n alt = false,\n }: {\n ctrl?: boolean\n alt?: boolean\n }\n): Promise<void> {\n return new Promise((resolve) => {\n promises.push({\n name,\n ctrl: ctrl || false,\n alt: alt || false,\n resolve,\n })\n })\n}\nexport class Input {\n static render(arr: string[], index: number): string {\n return arr\n .map((item, pindex) => {\n if (pindex === index) return '\\x1b[1m\\x1b[32m' + item + '\\x1b[0m' // 亮绿,高亮\n return '\\x1b[1m\\x1b[33m' + item + '\\x1b[0m' // 亮黄\n })\n .join(' ')\n }\n static select<T extends string[]>(tip: string, arr: T): Promise<T[number]> {\n let index: number = 0\n let win = false\n\n console.log(\n `\\x1b[2K\\x1b[47m\\x1b[1m\\x1b[30m${tip} ${i18n.commander.selectTip} \\x1b[0m\\x1b[?25l`\n )\n console.log(Input.render(arr, index) + '\\n\\x1b[1A')\n\n const handlerNext = () => {\n if (win) return\n index++\n if (index >= arr.length) index = 0\n console.log(`\\x1b[1A${Input.render(arr, index)}\\n\\x1b[1A`)\n click('n', {\n ctrl: false,\n alt: false,\n }).then(handlerNext)\n }\n\n return new Promise((resolve) => {\n click('n', {\n ctrl: false,\n alt: false,\n }).then(handlerNext)\n click('b', {\n ctrl: false,\n alt: false,\n }).then(() => {\n win = true\n process.stdout.write('\\x1b[?25h')\n resolve(arr[index]!)\n })\n })\n }\n static use(\n task: (name: string, ctrl: boolean, alt: boolean, raw: string) => void\n ) {\n tasks.push(task)\n }\n}\nprocess.stdin.on('keypress', (str: string, key) => {\n const rawKeyName = key?.name || ''\n const ctrl = Boolean(key?.ctrl)\n const alt = Boolean(key?.alt)\n\n handler(\n rawKeyName,\n {\n ctrl,\n alt,\n },\n str\n )\n})\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport os from 'node:os'\nconst logFile = path.join(os.homedir(), '.cache/mbler/latest.log')\n\nfunction _clean(promise: Promise<void>): () => void {\n return () => {\n Logger.run = Logger.run.filter((item: Promise<void>) => {\n return item !== promise\n })\n }\n}\nasync function fileExists(file: string): Promise<boolean> {\n try {\n const f = await fs.stat(file)\n if (f) return true\n } catch {\n return false\n }\n return false\n}\nfunction writeLog(logContent: string): void {\n async function write() {\n try {\n const dir = path.dirname(logFile)\n if (!(await fileExists(dir))) {\n // ensure the directory exists, root-to-leaf\n await fs.mkdir(dir, { recursive: true }).catch(() => void 0)\n }\n // if file does not exist, create it (touch)\n if (!(await fileExists(logFile))) {\n await fs.writeFile(logFile, '')\n }\n } catch (err) {\n // if we can't prepare the log file, output to stderr but don't crash\n console.error('[logger] unable to prepare log file:', err)\n return\n }\n\n try {\n await fs.appendFile(logFile, '\\n' + logContent)\n } catch (err) {\n console.error('[logger] failed to append to log file:', err)\n }\n }\n const asy = write()\n Logger.run.push(asy.then(_clean(asy)))\n}\nexport default class Logger {\n public static LogFile = logFile\n public static run: Promise<void>[] = []\n private static _b(tag: string, msg: string, t: string): void {\n const date = new Date()\n const logContent = [\n `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`,\n `[${t} ${tag}]`,\n msg,\n ].join(' ')\n writeLog(logContent)\n }\n public static w(tag: string, msg: string): void {\n Logger._b(tag, msg, 'WARN')\n }\n public static e(tag: string, msg: string): void {\n Logger._b(tag, msg, 'ERROR')\n }\n public static i(tag: string, msg: string): void {\n Logger._b(tag, msg, 'INFO')\n }\n public static d(tag: string, msg: string): void {\n Logger._b(tag, msg, 'DEBUG')\n }\n}\n","type includesGroup = Record<string, 'file' | 'directory' | 'skip'>\nexport const BuildConfig = {\n ConfigFile: 'mbler.config.js' as const,\n salt: {\n header: 'd61e721d-a2c9-4535-8054-0183bce24767',\n sapi: '33e2c698-908f-45ab-8a9f-66018f8486ed',\n module: 'cbbacfa4-8b1e-4a9c-9cbd-7a0d2e5f0b3c',\n } as const,\n behavior: 'behavior' as const,\n resources: 'resources' as const,\n includes: {\n public: {\n 'pack_icon.png': 'file',\n 'manifest.json': 'file',\n },\n resources: {\n 'biomes_client.json': 'file',\n 'blocks.json': 'file',\n 'bug_pack_icon.png': 'file',\n 'contents.json': 'file',\n 'loading_messages.json': 'file',\n 'manifest_publish.json': 'file',\n 'signatures.json': 'file',\n 'sounds.json': 'file',\n 'splashes.json': 'file',\n animation_controllers: 'directory',\n animations: 'directory',\n attachables: 'directory',\n biomes: 'directory',\n cameras: 'directory',\n entity: 'directory',\n fogs: 'directory',\n font: 'directory',\n items: 'directory',\n library: 'directory',\n materials: 'directory',\n models: 'directory',\n particles: 'directory',\n render_controllers: 'directory',\n sounds: 'directory',\n texts: 'directory',\n textures: 'directory',\n },\n behavior: {\n aim_assist: 'directory',\n animation_controllers: 'directory',\n animations: 'directory',\n behavior_trees: 'directory',\n biomes: 'directory',\n blocks: 'directory',\n cameras: 'directory',\n dimensions: 'directory',\n entities: 'directory',\n feature_rules: 'directory',\n features: 'directory',\n functions: 'directory',\n item_catalog: 'directory',\n items: 'directory',\n loot_tables: 'directory',\n recipes: 'directory',\n /**\n * Skipped from the default copy flow; handled separately by the build:\n * - bundle: true → bundled via rollup\n * - bundle: false → copied as-is into the output\n */\n scripts: 'skip',\n spawn_rules: 'directory',\n structures: 'directory',\n texts: 'directory',\n trading: 'directory',\n worldgen: 'directory',\n 'contents.json': 'file',\n 'manifest_publish.json': 'file',\n 'signatures.json': 'file',\n },\n } as {\n public: includesGroup\n behavior: includesGroup\n resources: includesGroup\n },\n}\n","import * as fs from 'node:fs/promises'\nimport * as path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { MblerConfigData, templateMblerConfig } from '../types'\nimport { Input } from '../commander'\nimport { spawn } from 'node:child_process'\nimport { BuildConfig } from '../build/config'\nimport Logger from '../logger'\nexport function join(baseDir: string, inputPath: string): string {\n return path.isAbsolute(inputPath) ? inputPath : path.join(baseDir, inputPath)\n}\nexport async function ReadProjectMblerConfig(\n project: string\n): Promise<MblerConfigData> {\n const configPath = path.join(project, BuildConfig.ConfigFile)\n const fileExport = await import(\n process.platform === 'win32' ? pathToFileURL(configPath).href : configPath\n )\n const file = (fileExport as { default: MblerConfigData }).default || {}\n for (const key in file) {\n if (!(key in templateMblerConfig)) {\n throw new Error(\n `[read config]: read config from '${project}' error: Unexpected '${key}'`\n )\n }\n }\n const config: MblerConfigData = {\n ...templateMblerConfig,\n ...file,\n }\n try {\n const pkgRaw = await fs.readFile(\n path.join(project, 'package.json'),\n 'utf-8'\n )\n const pkg = JSON.parse(pkgRaw)\n if (file.name && pkg.name && file.name !== pkg.name) {\n throw new Error(\n `Package name mismatch: mbler.config.js (\"${file.name}\") != package.json (\"${pkg.name}\"). They must match.`\n )\n }\n if (pkg.name) config.name = pkg.name\n if (pkg.version) config.version = pkg.version\n } catch {\n // fallback to mbler.config.js or template defaults\n }\n if (!config.name) config.name = 'unknown'\n if (!config.version) config.version = '0.0.0'\n return config\n}\nexport async function readFileAsJson<T>(filePath: string): Promise<T> {\n try {\n const content = await fs.readFile(filePath, 'utf-8')\n const json = JSON.parse(content)\n return json as T\n } catch (err: unknown) {\n if (err instanceof Error) {\n throw err\n } else {\n throw new Error(err as string, { cause: err })\n }\n }\n}\nexport function sleep(time: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, time)\n })\n}\n/**\n * Print a single-line message to stdout with a trailing newline.\n * Exported here so other modules (for example `build`) do not need\n * to import from `cli`, avoiding a circular dependency.\n */\nlet outputQueue: string[] = []\nlet isFlushing = false\n\nexport async function flushOutputQueue(): Promise<void> {\n if (isFlushing || outputQueue.length === 0) return\n isFlushing = true\n try {\n while (outputQueue.length > 0) {\n const chunk = outputQueue.shift()\n if (chunk) {\n process.stdout.write(chunk)\n }\n }\n } finally {\n isFlushing = false\n }\n}\nprocess.on('exit', flushOutputQueue)\nexport function showText(text: string, needNextLine: boolean = true) {\n outputQueue.push(text + (needNextLine ? '\\n' : ''))\n if (!isFlushing) {\n Promise.resolve()\n .then(() => flushOutputQueue())\n .catch(() => {\n outputQueue = []\n isFlushing = false\n })\n }\n}\nexport function stringToNumberArray(str: string): [number, number, number] {\n return str\n .split('.')\n .map((s) => parseInt(s, 10))\n .slice(0, 3) as [number, number, number]\n}\nexport async function writeJSON(\n filePath: string,\n data: unknown\n): Promise<void> {\n const content = JSON.stringify(data, null, 2)\n if (!(await fileExists(path.dirname(filePath)))) {\n await fs\n .mkdir(path.dirname(filePath), { recursive: true })\n .catch(() => void 0)\n }\n return await fs.writeFile(filePath, content, 'utf-8')\n}\nexport function compareVersion(a: string, b: string): number {\n const pa = a.split('.').map((x) => parseInt(x, 10) || 0)\n const pb = b.split('.').map((x) => parseInt(x, 10) || 0)\n for (let i = 0; i < 3; i++) {\n const na = pa[i] || 0\n const nb = pb[i] || 0\n if (na !== nb) return na - nb\n }\n return 0\n}\nexport const input = (function (): (t: string, g?: boolean) => Promise<string> {\n type InputCallBack = (a: string) => void\n let curr: null | InputCallBack\n let currstr = ''\n let tip = ''\n let show = true\n // 在输入时使用输入中间件\n Input.use(function (\n raw: string,\n ctrl: boolean,\n alt: boolean,\n name: string\n ): void {\n if (typeof curr !== 'function') return\n if (ctrl || alt) return\n if (raw) {\n if (raw === 'return' || raw === 'enter') {\n curr(currstr)\n curr = null\n currstr = ''\n console.log('\\n')\n return\n }\n if (raw === 'backspace') {\n currstr = currstr.slice(0, -1)\n refreshInput()\n return\n }\n }\n if (name && typeof name === 'string') {\n currstr += name\n refreshInput()\n }\n })\n\n function refreshInput(): void {\n const out = `\\x1b[2K\\r${tip}${show ? currstr : ''}`\n process.stdout.write(out)\n }\n /**\n * 输入文本\n * @param{string} tip 提示\n * @param{boolean} show 是否显示输入\n */\n return async function (t: string = '', g: boolean = true): Promise<string> {\n return new Promise((resolve) => {\n flushOutputQueue().then(() => {\n show = g\n tip = t\n refreshInput()\n curr = resolve\n })\n })\n }\n})()\nexport function isValidVersion(version: string): boolean {\n const split = version.split('-')\n if (!split[0]) return false\n if (\n (split[0] as string)\n .split('.')\n .map(Number)\n .filter((i) => !Number.isNaN(i)).length !== 3\n )\n return false\n return true\n}\nexport function runCommand(\n param: string[],\n cwd: string,\n stdio: 'ignore' | 'pipe' | 'inherit'\n): Promise<{ code: number | null; data: string }> {\n let resolve: (result: { code: number | null; data: string }) => void\n let data = ''\n const promise = new Promise<{ code: number | null; data: string }>(\n (r) =>\n (resolve = (...argv) => {\n Logger.i(\n 'Utils: runCommand',\n `run command: '${param.join(' ')}' return: ${JSON.stringify(argv[0])}`\n )\n r(...argv)\n })\n )\n const p = spawn(param[0] as string, param.slice(1), {\n cwd: cwd,\n shell: process.platform === 'win32',\n stdio: stdio,\n timeout: 1000 * 60 * 10,\n })\n if (p.stdout) {\n p.stdout.on('data', (chunk: Buffer) => {\n data += chunk.toString()\n })\n }\n p.on('error', (_err) => {\n resolve({ code: -1, data })\n })\n p.on('close', (code) => {\n resolve({ code, data })\n })\n return promise\n}\nexport async function fileExists(file: string) {\n try {\n await fs.stat(file)\n return true\n } catch {\n return false\n }\n}\nconst README_CANDIDATES = [\n 'README.md',\n 'readme.md',\n 'Readme.md',\n 'README.MD',\n 'readme.MD',\n 'Readme.MD',\n 'README.markdown',\n 'readme.markdown',\n 'Readme.markdown',\n 'README',\n]\nexport async function findReadme(dir: string): Promise<string | null> {\n for (const name of README_CANDIDATES) {\n const full = path.join(dir, name)\n if (await fileExists(full)) return full\n }\n return null\n}\n","import { styleText } from 'node:util'\nimport { showText } from '../utils'\nexport class Progress {\n private max: number\n constructor(max: number) {\n this.max = max\n }\n\n update(current: number) {\n const percentage = Math.min(current, this.max) / this.max\n const barWidth = 30\n const filledWidth = Math.round(barWidth * percentage)\n const emptyWidth = barWidth - filledWidth\n const filledBar = styleText('green', '█'.repeat(filledWidth))\n const emptyBar = styleText('white', '█'.repeat(emptyWidth))\n const progressBar = `${filledBar}${emptyBar}`\n const percentText = styleText('blue', `${Math.round(percentage * 100)}%`)\n const progressText = `\\n\\u001B[1A\\r[${progressBar}] ${percentText} (${current}/${this.max})`\n showText(progressText, false)\n if (current == this.max) {\n showText('', true)\n }\n }\n}\n","export type BuildCacheMode = 'none' | 'memory' | 'file' | 'filesystem' | 'auto'\ntype EffectiveCacheMode = 'none' | 'memory' | 'file'\n\nexport class BuildCacheManager {\n private readonly mode: EffectiveCacheMode\n\n constructor(\n _projectRoot: string,\n mode: BuildCacheMode | undefined,\n _cachePath?: string\n ) {\n this.mode = this.resolveMode(mode)\n }\n\n public getMode() {\n return this.mode\n }\n\n public shouldUseIncrementalBuild(): boolean {\n return this.mode !== 'none'\n }\n\n private resolveMode(mode: BuildCacheMode | undefined): EffectiveCacheMode {\n if (mode === 'none') return 'none'\n return 'file'\n }\n}\n","import { tmpdir } from 'node:os'\nimport * as path from 'node:path'\n\nconst config = {\n tmpdir: path.join(tmpdir(), '.mbler'),\n mcxVersion: '0.0.2-beta.r7',\n mcxCoreVersion: '0.0.6',\n mblerVersion: '0.2.4-rc.4',\n defaultPmnxBASE: 'https://d.pmnx.qzz.io',\n}\nexport default config\n","import * as path from 'node:path'\nimport * as fs from 'node:fs'\nimport config from '../config'\nimport { compareVersion, sleep } from '../utils'\nimport type { npmFetchData } from '../types'\n\nexport interface cacheValue {\n formal: string\n beta: string\n}\n\nconst Sapi = function (): {\n refresh: () => Promise<void>\n generateVersion: (\n module: '@minecraft/server-ui' | '@minecraft/server',\n mcVersion: string,\n isBeta: boolean,\n withFull: boolean\n ) => Promise<string>\n} {\n const MAX_RETRIES = 3\n\n async function json(path: string, attempt = 1) {\n const r = await fetch('https://registry.npmjs.com' + path)\n if (!r.ok && attempt < MAX_RETRIES) {\n await sleep(1000 * attempt)\n return json(path, attempt + 1)\n }\n return await r.json()\n }\n\n const cacheFile = path.join(config.tmpdir, '_sapi_version.json')\n let cacheData: Array<{\n version: string\n server: cacheValue\n 'server-ui': cacheValue\n }> | null = null\n\n async function fetchData(\n pkgName: string\n ): Promise<Record<string, cacheValue>> {\n const data = (await json(`/${pkgName}`)) as unknown as npmFetchData\n const pkgVersions = Object.keys(data.versions)\n const reValue: Record<string, cacheValue> = {}\n\n const mcVersionFrom = (str: string): string | null => {\n const m = str.match(/-(?:rc|beta)(?:\\.[^-.]+)*?\\.((?:\\d+\\.){2}\\d+)/)\n return m ? (m[1] as string) : null\n }\n\n for (const v of pkgVersions) {\n const mcVersion = mcVersionFrom(v)\n if (!mcVersion) continue\n\n const isStable = /(?:-stable)(?:$|[-.])/.test(v)\n let entry = reValue[mcVersion]\n if (!entry) {\n entry = { formal: '', beta: '' }\n reValue[mcVersion] = entry\n }\n\n if (isStable) {\n if (!entry.formal || compareVersion(v, entry.formal) > 0) {\n entry.formal = v\n }\n } else {\n if (!entry.beta || compareVersion(v, entry.beta) > 0) {\n entry.beta = v\n }\n }\n }\n\n return reValue\n }\n\n async function refresh() {\n const serverMap = await fetchData('@minecraft/server')\n const uiMap = await fetchData('@minecraft/server-ui')\n const versions = new Set([\n ...Object.keys(serverMap),\n ...Object.keys(uiMap),\n ])\n\n const arr: Array<{\n version: string\n server: cacheValue\n 'server-ui': cacheValue\n }> = []\n\n for (const ver of versions) {\n arr.push({\n version: ver,\n server: serverMap[ver] ?? { formal: '', beta: '' },\n 'server-ui': uiMap[ver] ?? { formal: '', beta: '' },\n })\n }\n\n arr.sort((a, b) => compareVersion(a.version, b.version))\n cacheData = arr\n\n await fs.promises.mkdir(config.tmpdir, { recursive: true }).catch(() => {})\n await fs.promises.writeFile(cacheFile, JSON.stringify(arr, null, 2), 'utf-8')\n }\n\n async function generateVersion(\n module: '@minecraft/server-ui' | '@minecraft/server',\n mcVersion: string,\n isBeta: boolean,\n withFull: boolean = false\n ): Promise<string> {\n if (!cacheData) {\n try {\n const txt = await fs.promises.readFile(cacheFile, 'utf-8')\n cacheData = JSON.parse(txt)\n } catch {\n await refresh()\n }\n }\n\n if (!cacheData) {\n throw new Error(\n 'unable to load SAPI version data. Check network connectivity or delete ~/.mbler/_sapi_version.json and try again.'\n )\n }\n\n let entry = cacheData.find((e) => e.version === mcVersion)\n if (!entry) {\n let candidate: (typeof cacheData)[0] | null = null\n for (const e of cacheData) {\n if (compareVersion(e.version, mcVersion) <= 0) {\n candidate = e\n } else {\n break\n }\n }\n entry = candidate ?? cacheData[0]\n }\n\n if (!entry) {\n throw new Error(\n `no SAPI version data found for Minecraft version ${mcVersion}`\n )\n }\n\n const moduleKey = module === '@minecraft/server' ? 'server' : 'server-ui'\n const entryModule = entry[moduleKey]\n let result = isBeta ? entryModule.beta : entryModule.formal\n if (!result) {\n result = entryModule.formal || entryModule.beta\n }\n if (withFull) return result || ''\n return evalVersion(result || 'error')\n }\n\n return {\n refresh,\n generateVersion,\n }\n}\n\nlet sapiEmul: null | ReturnType<typeof Sapi> = null\nexport default new Proxy(\n {},\n {\n get(_, p) {\n if (!sapiEmul) sapiEmul = Sapi()\n return sapiEmul[p as keyof typeof sapiEmul]\n },\n set(_, p, n) {\n if (!sapiEmul) sapiEmul = Sapi()\n sapiEmul[p as keyof typeof sapiEmul] = n\n return true\n },\n }\n) as ReturnType<typeof Sapi>\n\nexport function evalVersion(result: string): string {\n const tmp = result.split('-').slice(0, 2) as [string, string]\n tmp[1] = tmp[1].split('.')[0] as string\n return tmp.join('-')\n}\n","import { createMCXLanguagePlugin } from '@mbler/mcx-server'\nimport { LanguagePlugin } from '@volar/language-core'\nimport { runTsc } from '@volar/typescript/lib/quickstart/runTsc.js'\n\n/**\n * 运行 MCX TypeScript 编译器\n * 为 .mcx 文件提供 TypeScript 类型检查支持\n */\nexport function runTSC(\n tscpath: string = require.resolve('typescript/lib/tsc')\n): void {\n runTsc(\n tscpath,\n {\n extraSupportedExtensions: [\n '.mcx',\n '.png',\n '.svg',\n '.jpg',\n '.jpeg',\n '.gif',\n ],\n extraExtensionsToRemove: [\n '.mcx',\n '.png',\n '.svg',\n '.jpg',\n '.jpeg',\n '.gif',\n ],\n },\n (ts): LanguagePlugin<string>[] => {\n return [createMCXLanguagePlugin(ts) as unknown as LanguagePlugin<string>]\n }\n )\n}\n\nexport default runTSC\n","import { env } from 'node:process'\nimport type AdmZip from 'adm-zip'\nfunction Release() {\n const AdmZip = require('adm-zip')\n function createFullZip(dir: string): AdmZip {\n const zip = new AdmZip()\n zip.addLocalFolder(dir)\n return zip\n }\n function createZipWithMoreFolder(dir: [string, string][]): AdmZip {\n const zip = new AdmZip()\n for (const folder of dir) {\n zip.addLocalFolder(folder[0], folder[1])\n }\n return zip\n }\n return async function generateRelease(build: {\n outdirs: {\n behavior: string\n resources: string\n dist: string\n }\n module: 'all' | 'behavior' | 'resources'\n }) {\n if (!build.outdirs) throw new Error('invalid Build')\n if (env.BUILD_MODULE !== 'release') return\n let zip: AdmZip\n if (build.module == 'all') {\n zip = createZipWithMoreFolder([\n [build.outdirs?.behavior, 'behavior'],\n [build.outdirs?.resources, 'resources'],\n ])\n } else if (build.module == 'behavior') {\n zip = createFullZip(build.outdirs?.behavior)\n } else {\n zip = createFullZip(build.outdirs?.resources)\n }\n await zip.writeZipPromise(build.outdirs?.dist as string)\n }\n}\nlet releaseEmul: ReturnType<typeof Release> | null = null\nconst generateRelease: ReturnType<typeof Release> = (...argv) => {\n if (!releaseEmul) releaseEmul = Release()\n return releaseEmul(...argv)\n}\nexport { generateRelease }\n","import { createRequire } from 'node:module'\nimport path from 'node:path'\nimport { pathToFileURL } from 'node:url'\nimport { type Plugin } from 'rolldown'\n\nfunction resolvePackage(name: string, baseBuildDir: string): string {\n const require = createRequire(path.join(baseBuildDir, 'noop.js'))\n try {\n return require.resolve(name, { paths: [baseBuildDir] })\n } catch {\n throw new Error(\n `\\`${name}\\` is required for minification. Install it in your project:\\n` +\n ` npm i -D ${name}\\n` +\n ` pnpm add -D ${name}\\n` +\n ` yarn add -D ${name}`\n )\n }\n}\n\nexport function terserPlugin(baseBuildDir: string): Plugin {\n return {\n name: 'mbler:terser',\n async generateBundle(_, bundle) {\n const terserPath = pathToFileURL(\n resolvePackage('terser', baseBuildDir)\n ).href\n const terser: typeof import('terser') = await import(terserPath)\n for (const [, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n const res = await terser.minify(chunk.code, {\n format: { comments: false },\n compress: { unused: true, dead_code: true, if_return: true },\n })\n if (res.code) chunk.code = res.code\n }\n },\n }\n}\n\nexport function esbuildPlugin(baseBuildDir: string): Plugin {\n return {\n name: 'mbler:esbuild',\n async generateBundle(_, bundle) {\n const esbuildPath = pathToFileURL(\n resolvePackage('esbuild', baseBuildDir)\n ).href\n const esbuild: typeof import('esbuild') = await import(esbuildPath)\n for (const [, chunk] of Object.entries(bundle)) {\n if (chunk.type !== 'chunk') continue\n const res = await esbuild.transform(chunk.code, {\n minify: true,\n loader: 'js',\n })\n chunk.code = res.code\n }\n },\n }\n}\n","/**\n * @description To generate uuid\n */\nimport crypto from 'node:crypto'\nexport const fromString = (input: string, salt: string = ''): string => {\n const combinedInput = salt + input\n const hash = crypto.createHash('sha256').update(combinedInput).digest('hex')\n const base = hash.slice(0, 32)\n const ls = '89ab'\n const r = (t: number) =>\n ls[(combinedInput.length + t + salt.length) % ls.length]\n // build to:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n const uuid = `${base.substring(0, 8)}-${base.substring(8, 12)}-4${base.substring(12, 15)}-8${r(1)}${r(2)}${r(3)}-${base.substring(18, 30)}`\n return uuid\n}\nexport default {\n fromString,\n uuid: crypto.randomUUID,\n}\n","import { extname } from 'node:path'\nimport { ManifestData, MblerConfigData } from '../types'\nimport { stringToNumberArray } from '../utils'\nimport { fromString } from '../uuid'\nimport { BuildConfig } from './config'\nimport Sapi from './sapi'\nimport { evalVersion } from './sapi'\nasync function generateManifest(\n config: MblerConfigData,\n type: 'data' | 'resources'\n): Promise<ManifestData> {\n const hashRaw = `${config.name}-${type}-${config.script?.lang || 'js'}--mbler-hash-raw--:build-manifest`\n const manifest: ManifestData = {\n format_version: 2,\n header: {\n name: config.displayName || config.name,\n description: config.description,\n uuid: fromString(hashRaw, BuildConfig.salt.header),\n version: stringToNumberArray(config.version),\n min_engine_version: stringToNumberArray(\n typeof config.mcVersion === 'string'\n ? config.mcVersion\n : (() => {\n throw new Error('mcVersion in mblerconfig should be a string')\n })()\n ),\n },\n modules: [\n {\n type: type,\n uuid: fromString(hashRaw, BuildConfig.salt.module),\n description: `From Mbler(https://github.com/RuanhoR/mbler). welcome to star and contribute!`,\n version: stringToNumberArray(config.version),\n },\n ],\n }\n if (type === 'data' && config.script) {\n const isBundle = config.build?.bundle !== false\n const outputDir = config.build?.outputDir || 'scripts'\n let entry: string\n if (isBundle) {\n let filename = config.script.main || 'index.js'\n if (config.build?.outputFilename) {\n filename = config.build.outputFilename\n }\n const extName = extname(filename)\n if (extName !== '.js') {\n filename = filename.slice(0, -extName.length) + '.js'\n }\n if (config.script.lang == 'mcx') {\n entry = `${outputDir}/index.js`\n } else {\n entry = `${outputDir}/${filename}`\n }\n } else {\n entry = `${outputDir}/${config.script.main || 'index.js'}`\n const extName = extname(entry)\n if (extName !== '.js') {\n entry = entry.slice(0, -extName.length) + '.js'\n }\n }\n manifest.modules.push({\n type: 'script',\n entry: entry,\n language: 'javascript',\n uuid: fromString(hashRaw, BuildConfig.salt.sapi),\n description: `sapi generate by mbler, weclome to download and star at https://github.com/RuanhoR/mbler`,\n version: stringToNumberArray(config.version),\n })\n manifest.capabilities = ['script_eval']\n manifest.dependencies = [\n {\n module_name: '@minecraft/server',\n version: evalVersion(\n await Sapi.generateVersion(\n '@minecraft/server',\n config.mcVersion,\n config.script?.UseBeta || false,\n false\n )\n ), // only major.minor.patch, remove -beta or -rc\n },\n ]\n if (config.script.ui) {\n manifest.dependencies.push({\n module_name: '@minecraft/server-ui',\n version: evalVersion(\n await Sapi.generateVersion(\n '@minecraft/server-ui',\n config.mcVersion,\n config.script?.UseBeta || false,\n false\n )\n ), // only major.minor.patch, remove -beta or -rc\n })\n }\n }\n return manifest\n}\nexport default generateManifest\n","import { watch as chokidarWatch } from 'chokidar'\nimport * as fs from 'node:fs/promises'\nimport path, { isAbsolute } from 'node:path'\nimport {\n type Plugin,\n type RolldownLog,\n type RolldownWatcherEvent,\n type RolldownOptions,\n type RolldownBuild,\n type RolldownWatcher,\n} from 'rolldown'\nimport { onEnd } from '../commander'\nimport Logger from '../logger'\nimport type { ManifestData, MblerBuildConfig, MblerConfigData } from '../types'\nimport {\n fileExists,\n join,\n ReadProjectMblerConfig,\n showText,\n writeJSON,\n} from '../utils'\nimport { BuildConfig } from './config'\nimport { Progress } from './progress'\nimport type { CompileOpt } from '@mbler/mcx-types'\nimport { styleText } from 'node:util'\nimport type { LanguagePlugin } from '@volar/language-core'\nimport { BuildCacheManager } from './cache'\n\nclass Build {\n currentConfig: MblerConfigData | null = null\n srcDirs:\n | {\n [key in 'behavior' | 'resources']: string\n }\n | null = null\n outdirs:\n | {\n [key in 'behavior' | 'resources' | 'dist']: string\n }\n | null = null\n mcxLanguagePluginCreator:\n | ((ts: typeof import('typescript')) => LanguagePlugin<unknown>)\n | null = null\n constructor(\n config: MblerConfigData,\n private baseBuildDir: string,\n private resolve: (a: number) => void,\n private isWatch: boolean = false\n ) {\n this.currentConfig = config\n }\n /**\n * Start the watch mode.\n * This will perform an initial build (if not already done) and then\n * start filesystem and rollup watchers.\n * Returns the watcher handles once they are created so that callers\n * (for example tests) can clean them up later.\n */\n public async watch() {\n try {\n onEnd(() => {\n if (this.watchers) {\n this.watchers.chokidar.close()\n this.watchers.rollup?.close()\n }\n })\n await this._watch()\n } catch (e) {\n if (e instanceof Error) {\n Logger.e('Watcher', e.stack || e.message)\n } else {\n Logger.e('Watcher', e + '')\n }\n showText('MBLER__ERR__WATCHER: ' + e + ' Log at ' + Logger.LogFile)\n this.resolve(1)\n return null\n }\n }\n\n public async start() {\n try {\n return await this.build()\n } catch (e) {\n if (e instanceof Error) {\n Logger.e('Build', e.stack || e.message)\n } else {\n Logger.e('Build', e + '')\n }\n showText(\n 'MBLER__ERR__BUILD: ' + (e as Error).stack + ' Log at ' + Logger.LogFile\n )\n this.resolve(1)\n }\n }\n /**\n * Handles returned from the currently-active watchers.\n * Set by {@link createWatcher} and exposed via {@link getWatchers}\n * so that external callers can close them when necessary (e.g. tests).\n */\n private watchers: {\n rollup: RolldownWatcher | null\n chokidar: ReturnType<typeof chokidarWatch>\n } | null = null\n\n /**\n * Returns the watcher handles if watch mode has been started.\n * Can be safely called even before `watch()` has been invoked.\n */\n public getWatchers() {\n return this.watchers\n }\n\n /**\n * Close any active watchers. The build process does not automatically\n * terminate the watchers unless the process exits; tests or CLI wrappers\n * can call this method to clean up resources.\n */\n public closeWatchers() {\n if (this.watchers) {\n this.watchers.chokidar.close()\n this.watchers.rollup?.close()\n this.watchers = null\n }\n }\n private isDebug = process.env.DEBUG == 'true'\n private rollupPlugin: Plugin[] | null = null\n private cacheManager: BuildCacheManager | null = null\n public init: boolean = false\n private buildConfig: Partial<MblerBuildConfig> | null = null\n /**\n * Which modules are present in the current project.\n * - \"behavior\" when only behavior code exists\n * - \"resources\" when only resource files exist\n * - \"all\" when both are present\n * This field is populated during `handlerOtherAddon`.\n */\n public module: 'behavior' | 'resources' | 'all' | null = null\n /**\n * Determine whether a path refers to a regular file or a directory.\n * Follows symbolic links recursively. Throws if the path exists but\n * is not one of the expected types.\n *\n * @param filePath file system path to inspect\n * @returns \"file\" or \"directory\"\n */\n private async fileType(filePath: string): Promise<'file' | 'directory'> {\n const stat = await fs.lstat(filePath)\n if (stat.isFile()) {\n return 'file'\n }\n if (stat.isDirectory()) {\n return 'directory'\n }\n if (stat.isSymbolicLink()) {\n return await this.fileType(await fs.readlink(filePath))\n }\n throw new Error('[build addon]: invalid file type')\n }\n /**\n * Perform a single build of the project located at {@link baseBuildDir}.\n * The process is roughly:\n * 1. load and validate the configuration file\n * 2. prepare source and output directory information\n * 3. copy addon files (behavior/resources)\n * 4. generate manifest.json files\n * 5. run rollup to bundle any script entry point\n *\n * If anything goes wrong the promise returned by the public wrapper\n * (`build()` function exported at the bottom of this file) will be\n * resolved with a non-zero code and appropriate log entries will be\n * emitted.\n */\n private async build() {\n if (!this.currentConfig) {\n throw new TypeError('[mbler Builder]: cannot load config')\n }\n const buildStart = performance.now()\n const progress = new Progress(100)\n this.init = true\n if (!isAbsolute(this.baseBuildDir)) {\n throw new Error('[init build]: build dir is not absolute path')\n }\n // save user build config\n if (this.currentConfig.build) this.buildConfig = this.currentConfig.build\n // init cache\n this.cacheManager = new BuildCacheManager(\n this.baseBuildDir,\n this.buildConfig?.cache,\n this.buildConfig?.cachePath\n )\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: init cache: cache mode: ${this.cacheManager.getMode()}`\n )\n }\n // run onStart hook\n if (this.buildConfig?.onStart)\n await this.buildConfig.onStart(this.currentConfig)\n // load data\n this.loadData()\n // batch exec\n await Promise.all([\n () => {\n if (this.buildConfig?.clean !== false && this.outdirs) {\n return Promise.all([\n fs.rm(this.outdirs.behavior, { recursive: true, force: true }),\n fs.rm(this.outdirs.resources, { recursive: true, force: true }),\n ])\n }\n },\n this.handlerOtherAddon(),\n ])\n if (!this.isWatch) {\n progress.update(10)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 10%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n await this.handlerManifest()\n if (!this.isWatch) {\n progress.update(30)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 30%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n const isBundle = this.currentConfig.build?.bundle !== false\n\n if (this.currentConfig.script) {\n if (isBundle) {\n const rBuild = (await this.createRollup()) as RolldownBuild\n if (!this.rollupPlugin || !this.outdirs) {\n throw new Error(`[build addon]: rollup instance not available`)\n }\n if (!this.isWatch) {\n progress.update(50)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 50%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n // write script\n let output = this.currentConfig.script?.main\n if (!output) output = 'index.js'\n if (path.extname(output) !== 'js')\n output =\n output.slice(0, output.length - path.extname(output).length) + '.js'\n if (this.buildConfig?.outputFilename)\n output = this.buildConfig.outputFilename\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const writeOptions: Record<string, unknown> = {\n file: join(path.join(this.outdirs.behavior, outputDir), output),\n format: 'esm',\n sourcemap: false,\n }\n if (this.currentConfig.minify === 'oxc') {\n writeOptions.minify = true\n }\n await rBuild.write(writeOptions)\n } else {\n // bundle: false – skip rollup, copy source scripts directly\n const srcScriptDir = path.join(this.srcDirs!.behavior, 'scripts')\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const outPath = path.join(this.outdirs!.behavior, outputDir)\n if (await fileExists(srcScriptDir)) {\n await fs.cp(srcScriptDir, outPath, { recursive: true, force: true })\n }\n }\n }\n if (!this.isWatch) {\n progress.update(70)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build 70%. usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n if (!this.outdirs || !this.module)\n throw new Error(`[build addon]: output directories not initialized`)\n if (process.env.BUILD_MODULE == 'release') {\n const generateRelease = require('./release').generateRelease\n await generateRelease({\n outdirs: this.outdirs,\n module: this.module,\n })\n }\n if (!this.isWatch) {\n progress.update(100)\n if (this.isDebug) {\n console.debug(\n `[mbler DEBUG]: success build. build usage time: ${performance.now() - buildStart}ms`\n )\n }\n }\n if (!this.isWatch) {\n const elapsed = ((performance.now() - buildStart) / 1000).toFixed(2)\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('green', `✓ built in ${elapsed}s`)}`\n )\n this.resolve(0)\n }\n }\n /**\n * Create and return a Rollup build instance configured for the\n * project's script. The Rollup configuration mirrors the options\n * used by the CLI when running manual builds.\n *\n * Returns undefined if the project does not define a script section\n * (in which case nothing needs to be bundled).\n */\n private async createRollup() {\n if (!this.currentConfig || !this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n // no script handle\n if (!this.currentConfig.script) return\n // entry file path\n const main = path.join(\n this.srcDirs.behavior,\n 'scripts',\n this.currentConfig.script.main\n )\n if (!(await fileExists(main))) {\n throw new Error(`[build addon]: main script not found: ${main}`)\n }\n const plugin: Plugin[] = []\n // moduleDir\n const moduleDir = path.join(this.baseBuildDir, 'node_modules')\n if (!(await fileExists(moduleDir))) {\n throw new Error(`[build addon]: node_modules not found: ${moduleDir}`)\n }\n // handle minify option\n if (this.currentConfig.minify) {\n if (\n !['oxc', 'terser', 'esbuild', undefined].includes(\n this.currentConfig.minify\n )\n ) {\n throw new TypeError(\n 'ERR: [mbler]: mbler.config.js include invalid minify option: ' +\n this.currentConfig.minify\n )\n }\n if (this.currentConfig.minify === 'terser') {\n // terser (need install terser in user's project)\n plugin.push(require('./minify').terserPlugin(this.baseBuildDir))\n } else if (this.currentConfig.minify === 'esbuild') {\n // esbuild (need install esbuild in user's project)\n plugin.push(require('./minify').esbuildPlugin(this.baseBuildDir))\n }\n // (minify: oxc) handle at write option\n }\n if (this.buildConfig?.rollupPlugins) {\n // push user plugins\n plugin.push(...this.buildConfig.rollupPlugins)\n }\n if (this.currentConfig.script?.lang == 'mcx') {\n // mcx dsl plugin handle\n try {\n const tsconfigPath = path.join(this.baseBuildDir, 'tsconfig.json')\n if (!(await fileExists(tsconfigPath))) {\n throw new Error(\n `[build addon]: tsconfig.json not found: ${tsconfigPath}`\n )\n }\n const pluginConfig: CompileOpt = {\n moduleDir: moduleDir,\n tsconfigPath: tsconfigPath,\n sourcemap: false,\n ts: await import('typescript'),\n }\n if (this.mcxLanguagePluginCreator) {\n pluginConfig.mcxLanguagePlugin = this.mcxLanguagePluginCreator\n }\n const rolldownPlugin = require('@mbler/mcx-core').rolldownPlugin\n plugin.push(rolldownPlugin(pluginConfig, this.outdirs!))\n } catch (err) {\n throw new Error(\n `[build addon]: mcx plugin is required but '@mbler/mcx-core' could not be loaded: ${err}`,\n { cause: err }\n )\n }\n }\n // save plugin array for watcher re-use\n this.rollupPlugin = plugin\n const rollupOption: RolldownOptions = {\n input: main,\n external: [\n '@minecraft/server',\n '@minecraft/server-ui',\n ...(this.buildConfig?.rollupExternal ?? []),\n ],\n plugins: plugin,\n experimental: {\n ...(this.cacheManager?.shouldUseIncrementalBuild()\n ? { incrementalBuild: true }\n : {}),\n },\n }\n // push user hook\n if (this.buildConfig?.onWarn) {\n const onWarn: (\n warning: RolldownLog | string,\n defaultHandler: (warning: string | (() => string)) => void\n ) => void = (warning, _defaultHandler) => {\n const msg =\n typeof warning === 'string'\n ? warning\n : warning.message || 'Unknown warning'\n this.buildConfig?.onWarn?.(this.currentConfig!, new Error(msg))\n }\n rollupOption.onwarn = onWarn\n }\n if (this.buildConfig?.onEnd) {\n plugin.push({\n name: 'build-end-plugin',\n buildEnd: () => {\n return this.buildConfig?.onEnd?.(this.currentConfig!)\n },\n })\n }\n const buildBundle = require('rolldown').rolldown\n return await buildBundle(rollupOption)\n }\n\n /**\n * Internal helper invoked by {@link watch}.\n * Ensures a build has been run before starting the watchers.\n */\n private async _watch() {\n // init build\n if (!this.init) {\n await this.build()\n }\n await this.createWatcher()\n // watchers field is populated by createWatcher\n }\n\n private isParent(parent: string, dir: string): boolean {\n const relative = path.relative(parent, dir)\n return (\n !!relative && !relative.startsWith('..') && !path.isAbsolute(relative)\n )\n }\n\n private isChange<T extends object>(\n oldObj: T,\n newObj: T,\n checkKeys: Array<keyof T>\n ): boolean {\n for (const key of checkKeys) {\n if (\n typeof oldObj[key] === 'object' &&\n typeof newObj[key] === 'object' &&\n oldObj[key] !== null &&\n newObj[key] !== null\n ) {\n if (\n this.isChange(\n oldObj[key] as T,\n newObj[key] as T,\n Object.getOwnPropertyNames(oldObj[key]) as Array<\n keyof typeof oldObj\n >\n )\n ) {\n return true\n }\n } else if (oldObj[key] !== newObj[key]) {\n return true\n }\n }\n return false\n }\n\n private async createRollupWatcher() {\n if (\n !this.srcDirs ||\n !this.outdirs ||\n !this.currentConfig ||\n !this.rollupPlugin\n )\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n let output = this.currentConfig.script?.main\n if (!output) output = 'index.js'\n if (path.extname(output) !== 'js')\n output =\n output.slice(0, output.length - path.extname(output).length) + '.js'\n if (this.buildConfig?.outputFilename)\n output = this.buildConfig.outputFilename\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const outputOptions: Record<string, unknown> = {\n file: join(path.join(this.outdirs.behavior, outputDir), output),\n format: 'esm',\n sourcemap: false,\n }\n if (this.currentConfig.minify === 'oxc') {\n outputOptions.minify = true\n }\n const rolldownWatch = require('rolldown').watch\n const rollupWatcher = rolldownWatch({\n input: path.join(\n this.srcDirs.behavior,\n 'scripts',\n this.currentConfig?.script?.main || ''\n ),\n external: [\n '@minecraft/server',\n '@minecraft/server-ui',\n ...(this.buildConfig?.rollupExternal ?? []),\n ],\n plugins: this.rollupPlugin!,\n experimental: {\n ...(this.cacheManager?.shouldUseIncrementalBuild()\n ? { incrementalBuild: true }\n : {}),\n },\n output: outputOptions,\n watch: {\n clearScreen: false,\n include: path.join(this.srcDirs.behavior, 'scripts/**/*'),\n exclude: [\n path.join(this.baseBuildDir, 'node_modules/**/*'),\n this.outdirs.behavior,\n this.outdirs.resources,\n this.outdirs.dist,\n ],\n } as Record<string, unknown>,\n })\n rollupWatcher.on('change', async (filePath: string) => {\n Logger.i('Watcher', `file changed: ${filePath}, start rebuild`)\n })\n rollupWatcher.on('event', async (event: RolldownWatcherEvent) => {\n if (event.code === 'ERROR') {\n Logger.e('Watcher', `rollup error: ${event.error.stack || event.error}`)\n showText(\n 'MBLER__ERR__ROLLUP: ' +\n (event.error.stack || event.error) +\n ' Log at ' +\n Logger.LogFile\n )\n } else if (event.code === 'END') {\n Logger.i('Watcher', `rebuild success`)\n } else if (event.code === 'BUNDLE_END') {\n // rolldown handles incremental build internally\n }\n })\n return rollupWatcher\n }\n private async onChange(filePath: string) {\n const isBundle = this.currentConfig?.build?.bundle !== false\n if (\n !this.srcDirs ||\n !this.outdirs ||\n !this.currentConfig ||\n (isBundle && !this.rollupPlugin) ||\n !this.watchers\n )\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const isConfigChange =\n path.relative(\n path.join(this.baseBuildDir, BuildConfig.ConfigFile),\n filePath\n ) === ''\n const isPkgChange =\n path.relative(path.join(this.baseBuildDir, 'package.json'), filePath) ===\n ''\n const isScriptsChange =\n !isBundle &&\n this.isParent(path.join(this.srcDirs.behavior, 'scripts'), filePath)\n const isBehaviorChange =\n this.isParent(this.srcDirs.behavior, filePath) &&\n !this.isParent(path.join(this.srcDirs.behavior, 'scripts'), filePath)\n const isResourcesChange = this.isParent(this.srcDirs.resources, filePath)\n if (isConfigChange || isPkgChange) {\n const oldConfig = this.currentConfig\n Logger.i('Watcher', 'detected config change, reload config')\n this.currentConfig = await ReadProjectMblerConfig(this.baseBuildDir)\n this.buildConfig = this.currentConfig.build || null\n this.cacheManager = new BuildCacheManager(\n this.baseBuildDir,\n this.buildConfig?.cache,\n this.buildConfig?.cachePath\n )\n this.loadData()\n if (\n this.isChange(oldConfig, this.currentConfig, [\n 'name',\n 'version',\n 'description',\n 'mcVersion',\n ] as Array<keyof typeof oldConfig>)\n ) {\n await this.handlerManifest()\n }\n if (\n this.isChange(oldConfig, this.currentConfig, [\n 'script',\n 'outdir',\n 'build',\n ])\n ) {\n const newIsBundle = this.currentConfig.build?.bundle !== false\n if (newIsBundle && this.watchers.rollup) {\n this.watchers.rollup.close()\n await this.createRollup()\n this.watchers.rollup = await this.createRollupWatcher()\n } else if (newIsBundle) {\n await this.createRollup()\n this.watchers.rollup = await this.createRollupWatcher()\n } else {\n if (this.watchers.rollup) {\n this.watchers.rollup.close()\n }\n this.watchers.rollup = null\n }\n }\n }\n // if bundle: false and a script file changed, copy it directly\n if (isScriptsChange) {\n const outputDir = this.buildConfig?.outputDir || 'scripts'\n const relativePath = path.relative(\n path.join(this.srcDirs.behavior, 'scripts'),\n filePath\n )\n await fs.cp(\n filePath,\n path.join(this.outdirs.behavior, outputDir, relativePath),\n { recursive: true, force: true }\n )\n }\n // if behavior or resources change, we can just copy the changed file instead of copy all files again.\n if (isBehaviorChange || isResourcesChange) {\n const handlerBP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const relativePath = path.relative(this.srcDirs.behavior, filePath)\n await fs.cp(\n path.join(this.srcDirs.behavior, relativePath),\n path.join(this.outdirs.behavior, relativePath),\n {\n recursive: true,\n force: true,\n }\n )\n }\n const handlerRP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const relativePath = path.relative(this.srcDirs.resources, filePath)\n await fs.cp(\n path.join(this.srcDirs.resources, relativePath),\n path.join(this.outdirs.resources, relativePath),\n {\n recursive: true,\n force: true,\n }\n )\n }\n if (isBehaviorChange) {\n await handlerBP()\n }\n if (isResourcesChange) {\n await handlerRP()\n }\n }\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('bgYellow', `file changed: ${filePath}`)}`\n )\n }\n\n private async createWatcher() {\n const isBundle = this.currentConfig?.build?.bundle !== false\n if (!this.srcDirs || !this.outdirs || (isBundle && !this.rollupPlugin))\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const chokidar = chokidarWatch(this.baseBuildDir, {\n ignored: [\n this.outdirs.behavior,\n this.outdirs.resources,\n this.outdirs.dist,\n path.join(this.baseBuildDir, 'node_modules'),\n ],\n ignoreInitial: true,\n interval: 100,\n })\n const onChange = async (filePath: string) => {\n await this.onChange(filePath)\n }\n chokidar.on('change', onChange)\n if (isBundle && this.currentConfig?.script) {\n const rollupWatcher = await this.createRollupWatcher()\n this.watchers = {\n chokidar,\n rollup: rollupWatcher,\n }\n } else {\n this.watchers = {\n chokidar,\n rollup: null,\n }\n }\n }\n\n private async handlerManifest() {\n if (!this.currentConfig || !this.outdirs || !this.srcDirs || !this.module)\n throw new Error(\n `[build addon]: internal error: called before initialization`\n )\n const otherManifestOption: {\n behavior: ManifestData\n resources: ManifestData\n } = {\n behavior: {} as ManifestData,\n resources: {} as ManifestData,\n }\n const generateManifest = require('./manifest').default\n const loadOtherManifest = async (moduleType: 'behavior' | 'resources') => {\n const filePath = path.join(this.srcDirs![moduleType], 'manifest.json')\n if (await fileExists(filePath)) {\n try {\n const content = await fs.readFile(filePath, 'utf-8')\n return JSON.parse(content) as ManifestData\n } catch (_err) {\n Logger.w('Build', `invalid manifest.json in ${moduleType}`)\n }\n }\n return {} as ManifestData\n }\n const tasks: Promise<void>[] = []\n if (this.module == 'behavior' || this.module == 'all') {\n tasks.push(\n (async () => {\n otherManifestOption.behavior = await loadOtherManifest('behavior')\n const manifest = await generateManifest(this.currentConfig!, 'data')\n await writeJSON(path.join(this.outdirs!.behavior, 'manifest.json'), {\n ...manifest,\n ...otherManifestOption.behavior,\n })\n })()\n )\n }\n if (this.module == 'resources' || this.module == 'all') {\n tasks.push(\n (async () => {\n otherManifestOption.resources = await loadOtherManifest('resources')\n const manifest = await generateManifest(\n this.currentConfig!,\n 'resources'\n )\n await writeJSON(path.join(this.outdirs!.resources, 'manifest.json'), {\n ...manifest,\n ...otherManifestOption.resources,\n })\n })()\n )\n }\n await Promise.all(tasks)\n }\n\n private loadData() {\n // check run time\n if (!this.currentConfig || !this.baseBuildDir)\n throw new Error('[build data]: already initialized')\n // source code dir\n this.srcDirs = {\n behavior: path.join(this.baseBuildDir, BuildConfig.behavior),\n resources: path.join(this.baseBuildDir, BuildConfig.resources), // res\n }\n // output dir\n this.outdirs = {\n behavior: this.currentConfig.outdir?.behavior\n ? join(this.baseBuildDir, this.currentConfig.outdir.behavior)\n : path.join(this.baseBuildDir, 'dist/dep'),\n resources: this.currentConfig.outdir?.resources\n ? join(this.baseBuildDir, this.currentConfig.outdir.resources)\n : path.join(this.baseBuildDir, 'dist/res'),\n dist: this.currentConfig.outdir?.dist\n ? join(this.baseBuildDir, this.currentConfig.outdir.dist)\n : path.join(this.baseBuildDir, 'dist-pkg'),\n }\n }\n\n /**\n * Copy the various files (behavior/resources) into the corresponding\n * output directories and determine which modules exist in the project\n * by inspecting the source directories.\n */\n private async handlerOtherAddon() {\n if (!this.srcDirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n const isHasBp = await fileExists(this.srcDirs.behavior)\n if (!isHasBp)\n throw new Error('[build addon]: behavior source directory not found')\n // init copy resources\n const handlerBP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n for (const f of await fs.readdir(this.srcDirs.behavior)) {\n const fType = await this.fileType(path.join(this.srcDirs.behavior, f))\n const includeType =\n BuildConfig.includes.behavior[f] || BuildConfig.includes.public[f]\n if (includeType == fType) {\n await fs.cp(\n path.join(this.srcDirs.behavior, f),\n path.join(this.outdirs.behavior, f),\n {\n recursive: true,\n force: true,\n }\n )\n } else if (includeType == 'skip') {\n continue\n } else {\n throw new Error(\n `[build addon]: invalid file: ${path.join(this.srcDirs.behavior, f)}: type: ${fType}`\n )\n }\n }\n }\n const handlerRP = async () => {\n if (!this.srcDirs || !this.outdirs)\n throw new Error(\n '[build addon]: internal error: called before initialization'\n )\n for (const f of await fs.readdir(this.srcDirs.resources)) {\n const fType = await this.fileType(path.join(this.srcDirs.resources, f))\n const includeType =\n BuildConfig.includes.resources[f] || BuildConfig.includes.public[f]\n if (includeType == fType) {\n await fs.cp(\n path.join(this.srcDirs.resources, f),\n path.join(this.outdirs.resources, f),\n {\n recursive: true,\n force: true,\n }\n )\n } else if (includeType == 'skip') {\n continue\n } else {\n throw new Error(\n `[build addon]: invalid file: ${path.join(this.srcDirs.resources, f)}: type: ${fType}`\n )\n }\n }\n }\n const tasks: Promise<void>[] = []\n if (await fileExists(this.srcDirs.behavior)) {\n this.module = 'behavior'\n tasks.push(handlerBP())\n }\n if (await fileExists(this.srcDirs.resources)) {\n if (this.module == 'behavior') {\n this.module = 'all'\n } else {\n this.module = 'resources'\n }\n tasks.push(handlerRP())\n }\n if (!this.module) {\n throw new Error(\n \"[build addon]: couldn't resolve source code (your behavior or resources code is not found)\"\n )\n }\n await Promise.all(tasks)\n }\n}\nfunction build(config: MblerConfigData, work: string): Promise<number> {\n return new Promise<number>((resolve) => {\n new Build(config, work, resolve).start()\n })\n}\nfunction watch(config: MblerConfigData, work: string): Promise<number> {\n return new Promise<number>((resolve, reject) => {\n try {\n const build = new Build(config, work, resolve, true)\n build.start().then(() => {\n build.watch()\n showText(\n `[${styleText('green', 'mbler')}] ${styleText('bgYellow', 'watching for file changes...')}`\n )\n })\n } catch (err) {\n if (err instanceof Error) {\n reject(`[watcher]: error ${err.stack || err.message}`)\n } else {\n reject(err)\n }\n }\n })\n}\nexport { build, watch }\nexport default Build\nexport { Build }\nexport { default as Sapi } from './sapi'\nexport { default as McxTsc } from './plugin-mcx-tsc'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEa,gBAAgB,CAAC,MAAM,KAAK;CAC5B,UAAU;EACrB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;C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