mbler 0.1.3-alpha → 0.1.3-alpha-r2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +15 -6
- package/bin/mbler.js +12 -12
- package/bin/minify.js +58 -44
- package/lib/build/base.js +1 -297
- package/lib/build/build-g-config.json +12 -12
- package/lib/build/getModule.js +1 -182
- package/lib/build/index.js +1 -370
- package/lib/build/manifest.build.js +1 -103
- package/lib/build/mcVersion.js +1 -86
- package/lib/build/utils.js +1 -6
- package/lib/code-processor/c-handler-export.js +1 -12
- package/lib/code-processor/index.js +1 -141
- package/lib/code-processor/mtreehandler.js +1 -164
- package/lib/commander/index.js +1 -154
- package/lib/data/includes.json +13 -13
- package/lib/data/version.json +88 -88
- package/lib/git/clone.js +1 -28
- package/lib/git/index.js +1 -12
- package/lib/git/pull.js +1 -100
- package/lib/lang/__translate.js +1 -93
- package/lib/lang/en.js +1 -128
- package/lib/lang/index.js +1 -78
- package/lib/lang/zh.js +1 -146
- package/lib/loger/colors.js +1 -13
- package/lib/loger/index.js +1 -136
- package/lib/mcx/ast/index.js +1 -11
- package/lib/mcx/ast/prop.js +1 -78
- package/lib/mcx/ast/tag.js +1 -246
- package/lib/mcx/compile-component/lib.js +1 -106
- package/lib/mcx/compile-component/types.js +1 -2
- package/lib/mcx/compile-component/utils.js +1 -26
- package/lib/mcx/compile-mcx/compile.js +1 -34
- package/lib/mcx/compile-mcx/compiler/bundler.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileData.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileMain.js +1 -0
- package/lib/mcx/compile-mcx/compiler/index.js +1 -0
- package/lib/mcx/compile-mcx/compiler/utils.js +1 -0
- package/lib/mcx/compile-mcx/context.js +1 -19
- package/lib/mcx/compile-mcx/index.js +1 -10
- package/lib/mcx/compile-mcx/mcx/index.js +1 -2
- package/lib/mcx/compile-mcx/mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/template/module.js +1 -42
- package/lib/mcx/compile-mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/utils.node.js +1 -207
- package/lib/mcx/index.js +1 -13
- package/lib/mcx/test/index.js +1 -7
- package/lib/mcx/test.js +1 -21
- package/lib/mcx/types.js +1 -2
- package/lib/mcx/utils.js +1 -86
- package/lib/module-handler/index.js +1 -482
- package/lib/modules/create-game/mbler.config.json +13 -13
- package/lib/modules/create-game/src/Runner/RunnerManager.js +1 -113
- package/lib/modules/create-game/src/Runner/scriptRunner.js +1 -70
- package/lib/modules/create-game/src/config.js +1 -27
- package/lib/modules/create-game/src/constants.js +1 -19
- package/lib/modules/create-game/src/createGameModule.js +1 -24
- package/lib/modules/create-game/src/gameComponent/common/autoStop.js +1 -38
- package/lib/modules/create-game/src/gameComponent/common/lazyLoader.js +1 -76
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/stopWatch.js +1 -90
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/timer/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/timer.js +1 -87
- package/lib/modules/create-game/src/gameComponent/gameComponent.js +1 -53
- package/lib/modules/create-game/src/gameComponent/index.js +1 -31
- package/lib/modules/create-game/src/gameComponent/player/blockInteractionBlocker.js +1 -40
- package/lib/modules/create-game/src/gameComponent/player/entityInteractionBlocker.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/healthIndicator.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/regionMonitor.js +1 -22
- package/lib/modules/create-game/src/gameComponent/player/respawn.js +1 -59
- package/lib/modules/create-game/src/gameComponent/player/spawnProtector.js +1 -69
- package/lib/modules/create-game/src/gameComponent/region/regionProtecter.js +1 -53
- package/lib/modules/create-game/src/gameComponent/region/regionTeamChooser.js +1 -71
- package/lib/modules/create-game/src/gameComponent/region/regionTeamCleaner.js +1 -20
- package/lib/modules/create-game/src/gameComponent/view/infoScoreboard.js +1 -77
- package/lib/modules/create-game/src/gameComponent/view/teamScoreboard.js +1 -83
- package/lib/modules/create-game/src/gameContext.js +1 -6
- package/lib/modules/create-game/src/gameEngine.js +1 -139
- package/lib/modules/create-game/src/gameEvent/eventManager.js +1 -108
- package/lib/modules/create-game/src/gameEvent/eventSignal.js +1 -28
- package/lib/modules/create-game/src/gameEvent/events/buttonPush.js +1 -41
- package/lib/modules/create-game/src/gameEvent/events/inSlot.js +1 -77
- package/lib/modules/create-game/src/gameEvent/events/interval.js +1 -51
- package/lib/modules/create-game/src/gameEvent/events/itemUse.js +1 -36
- package/lib/modules/create-game/src/gameEvent/events/onBlock.js +1 -106
- package/lib/modules/create-game/src/gameEvent/events/regionEvents.js +1 -105
- package/lib/modules/create-game/src/gameEvent/events/signClick.js +1 -45
- package/lib/modules/create-game/src/gameEvent/gameEvent.js +1 -54
- package/lib/modules/create-game/src/gameEvent/index.js +1 -20
- package/lib/modules/create-game/src/gameEvent/mapEventSignal.js +1 -101
- package/lib/modules/create-game/src/gameEvent/subscription.js +1 -17
- package/lib/modules/create-game/src/gamePlayer/gamePlayer.js +1 -102
- package/lib/modules/create-game/src/gamePlayer/groupBuilder.js +1 -38
- package/lib/modules/create-game/src/gamePlayer/groupSet.js +1 -96
- package/lib/modules/create-game/src/gamePlayer/index.js +1 -25
- package/lib/modules/create-game/src/gamePlayer/playerGroup.js +1 -145
- package/lib/modules/create-game/src/gamePlayer/playerManager.js +1 -57
- package/lib/modules/create-game/src/gameRegion/gameRegion.js +1 -229
- package/lib/modules/create-game/src/gameRegion/index.js +1 -43
- package/lib/modules/create-game/src/gameRegion/regionHelper.js +1 -79
- package/lib/modules/create-game/src/gameState/common/autoStop.js +1 -39
- package/lib/modules/create-game/src/gameState/gameState.js +1 -169
- package/lib/modules/create-game/src/gameState/index.js +1 -7
- package/lib/modules/create-game/src/gameState/types.js +1 -35
- package/lib/modules/create-game/src/gameStructure/gameStructure.js +1 -36
- package/lib/modules/create-game/src/main.js +1 -86
- package/lib/modules/create-game/src/system/gameCommand.js +1 -107
- package/lib/modules/create-game/src/system/gameManager.js +1 -124
- package/lib/modules/create-game/src/system/globalPlayerManager.js +1 -119
- package/lib/modules/create-game/src/utils/GameError.js +1 -31
- package/lib/modules/create-game/src/utils/algorithm.js +1 -95
- package/lib/modules/create-game/src/utils/chunk.js +1 -63
- package/lib/modules/create-game/src/utils/deferredObject.js +1 -27
- package/lib/modules/create-game/src/utils/duration.js +1 -25
- package/lib/modules/create-game/src/utils/func.js +1 -20
- package/lib/modules/create-game/src/utils/index.js +1 -52
- package/lib/modules/create-game/src/utils/interfaces.js +1 -2
- package/lib/modules/create-game/src/utils/logger.js +1 -47
- package/lib/modules/create-game/src/utils/random.js +1 -76
- package/lib/modules/create-game/src/utils/vanila-data.js +1 -123
- package/lib/modules/create-game/src/utils/vector.js +1 -96
- package/lib/modules/gameLib/mbler.config.json +15 -15
- package/lib/modules/gameLib/src/config.js +1 -134
- package/lib/modules/gameLib/src/data.js +1 -77
- package/lib/modules/gameLib/src/entity.js +1 -256
- package/lib/modules/gameLib/src/event.js +1 -285
- package/lib/modules/gameLib/src/index.js +1 -20
- package/lib/modules/gameLib/src/loger.js +1 -21
- package/lib/modules/gameLib/src/ui.js +1 -209
- package/lib/modules/gameLib/src/utils.js +1 -122
- package/lib/modules/gutils/mbler.config.json +11 -11
- package/lib/modules/gutils/src/index.js +1 -22
- package/lib/modules/innerDef.json +4 -4
- package/lib/runTemp/File.js +1 -54
- package/lib/runTemp/config.json +3 -3
- package/lib/runTemp/index.js +1 -137
- package/lib/runTemp/securityFile.js +1 -93
- package/lib/start/addPack.js +1 -3
- package/lib/start/clean.js +1 -84
- package/lib/start/create.js +1 -146
- package/lib/start/dev.js +1 -99
- package/lib/start/getResConfig.js +1 -3
- package/lib/start/incg.js +1 -3
- package/lib/start/index.js +1 -207
- package/lib/start/init.js +1 -125
- package/lib/start/rechce.js +1 -57
- package/lib/start/unaddPack.js +1 -3
- package/lib/start/unincg.js +1 -67
- package/lib/start/version.js +1 -73
- package/lib/utils/index.js +1 -298
- package/lib/uuid/index.js +1 -27
- package/package.json +49 -1
- package/test/2x sword/behavior/scripts/index.js +24 -24
- package/test/2x sword/mbler.config.json +11 -11
- package/test/2x sword/package.json +13 -13
- package/test/README.md +7 -7
- package/test/des/index.js +19 -19
- package/test/des/mbler.config.json +4 -4
- package/test/des/package.json +6 -6
- package/test/initializer/index.js +5 -5
- package/test/initializer/mbler.config.json +4 -4
- package/test/initializer/package.json +6 -6
- package/test/mbler-int/behavior/res/items/mang_one_int.json +21 -21
- package/test/mbler-int/behavior/scripts/index.js +7 -7
- package/test/mbler-int/behavior/scripts/lib/event/index.js +19 -19
- package/test/mbler-int/behavior/scripts/lib/ui/Lore.js +18 -18
- package/test/mbler-int/behavior/scripts/lib/ui/baseUi.js +6 -6
- package/test/mbler-int/behavior/scripts/lib/ui/index.js +206 -206
- package/test/mbler-int/behavior/scripts/lib/utils/index.js +51 -51
- package/test/mbler-int/mbler.config.json +18 -18
- package/test/mbler-int/package.json +12 -12
- package/test/script-mbler/behavior/scripts/index.js +5 -0
- package/test/script-mbler/behavior/scripts/index.ts +5 -5
- package/test/script-mbler/mbler.config.json +14 -14
- package/test/script-mbler/package.json +15 -15
- package/lib/mcx/compile-mcx/_compile.js +0 -602
package/lib/lang/en.js
CHANGED
|
@@ -1,128 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
"help": "MBLER\nMinecraft Bedrock Edition\nAddon Bulider In Nodejs\nnodejs build tools on bedrock version of minecraft\nSolve the problem of checking documents everywhere to configure api version\nUsage: node index.js [command]\n* You can also omit the node prefix after npm link link\nCommands: dev, install, build, init, version, -v, web_edit, clean, checkout, -c, -i, v, create, recache, lang\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/",
|
|
5
|
-
"config_invalid": "Non-GameLib projects",
|
|
6
|
-
"err_bulid": "Build error",
|
|
7
|
-
"uncommand": "Invalid command",
|
|
8
|
-
"s0": "Operation successful",
|
|
9
|
-
"noGit": "Git security restrictions detected\nGit is rejecting the operation because the directory might not belong to the current user or be in a system-protected path.\nPlease select a processing method:\n\n1: Only add the current directory to the trusted zone (recommended, safe)\n2: Globally trust all directories (not recommended, but convenient)\n3: Cancel operation",
|
|
10
|
-
"SameDes": "Dependencies with the same name",
|
|
11
|
-
"invalidConfig": "Invalid configuration",
|
|
12
|
-
"inited": "Already initialized",
|
|
13
|
-
"noGitRepo": "The requested git repository was not specified and the installation failed.",
|
|
14
|
-
"invalidDes": "invalid dependency",
|
|
15
|
-
"workPackV": "Current working directory package version:",
|
|
16
|
-
"cleanFinally": "Clean build successful",
|
|
17
|
-
"noCommandTip": "Do you want to express:",
|
|
18
|
-
"init": {
|
|
19
|
-
"name": "Project name:",
|
|
20
|
-
"desc": "Project description:",
|
|
21
|
-
"useMcVersion": "Supported minecraft versions:",
|
|
22
|
-
"useSapi": "Use Script API? (Y/N)",
|
|
23
|
-
"useTs": "Using TypeScript? (Y/N)",
|
|
24
|
-
"InputFormatErr": "It is not the correct version number in x.x.x format, please re-enter it.",
|
|
25
|
-
"main": "Main script path (such as ./index.js):",
|
|
26
|
-
"useUi": "Use UI? (Y/N)",
|
|
27
|
-
"ReInput": "Not meeting specifications. Try again:"
|
|
28
|
-
},
|
|
29
|
-
"dev": {
|
|
30
|
-
"start": "Start monitoring the build in real time. The following is the first build.",
|
|
31
|
-
"start_d": "Start an incremental build",
|
|
32
|
-
"tip": "Listen for changes:"
|
|
33
|
-
},
|
|
34
|
-
"installGit": {
|
|
35
|
-
"NoPackage": "This GIT repository does not contain a properly configured mbler",
|
|
36
|
-
"InstallFinally": "Installation completed",
|
|
37
|
-
"HadBeen": "There is already a dependent package with the same package name. Do you want to replace it? Y/N",
|
|
38
|
-
"SetContent": "Modifying index table"
|
|
39
|
-
},
|
|
40
|
-
"vm": {
|
|
41
|
-
"shouldNotImp": "Importing a module is prohibited because it can be used in unsafe ways",
|
|
42
|
-
"runScriptErr": "Error running script, error stack"
|
|
43
|
-
},
|
|
44
|
-
"build": {
|
|
45
|
-
"build_info_header": "--- Build information list ---",
|
|
46
|
-
"project_path": "Project path:",
|
|
47
|
-
"output_dir": "Output directory:",
|
|
48
|
-
"minify_enabled": "Enable compression:",
|
|
49
|
-
"build_time": "Build time:",
|
|
50
|
-
"build_success": "Build successfully. Time taken:",
|
|
51
|
-
"build_failed": "Build failed",
|
|
52
|
-
"config_invalid": "Invalid configuration",
|
|
53
|
-
"package_file_missing_fields": "Missing fields: required fields [\"name\",\"description\",\"version\",\"mcVersion\"]",
|
|
54
|
-
"script_main_entry_missing": "script is enabled, but main entry file is not specified",
|
|
55
|
-
"subpack_folder_not_found": "{id} sub-package folder does not exist, packaging failed",
|
|
56
|
-
"subpack_processing_failed": "Subpackage {id} failed to process: {error}",
|
|
57
|
-
"includes_not_array": "includes.json is not an array, skip resource copying",
|
|
58
|
-
"ts_no_files": "No .ts files found, skipping TypeScript compilation",
|
|
59
|
-
"ts_diagnostics": "{file} ({line},{character}): {message}",
|
|
60
|
-
"ts_compilation_error": "Error compiling TypeScript",
|
|
61
|
-
"no_ts_files_skip": "No .ts files found, skipping TypeScript compilation",
|
|
62
|
-
"copying_subpack_script": "Subpackage script directory copied",
|
|
63
|
-
"copying_subpack_resources": "Copying subpackage other resources",
|
|
64
|
-
"removing_js_files": "Remove the .js files in the script directory",
|
|
65
|
-
"copying_compiled_ts": "Copy the compiled TypeScript file",
|
|
66
|
-
"minification_error": "Code compression failed",
|
|
67
|
-
"temp_mod_init": "Initialize temporary module directory",
|
|
68
|
-
"script_entry_required": "script is enabled but the main entry is not set",
|
|
69
|
-
"invalid_script_entry": "The main entry file is empty or invalid",
|
|
70
|
-
"module_copy_success": "Module copied to output directory",
|
|
71
|
-
"invalid_subpack_type": "subpack is not an object, skip processing",
|
|
72
|
-
"invalid_includes_type": "includes.json is not an array, skip resource copying",
|
|
73
|
-
"handle_includes_info": "Handle includes resource copy",
|
|
74
|
-
"minification_skipped": "includes.json is not an array, skips code compression",
|
|
75
|
-
"remove_js_files_info": "Remove compiled .js files (e.g. from ts)",
|
|
76
|
-
"process_minification": "Start code compression processing",
|
|
77
|
-
"copy_compiled_ts_only": "Copy only compiled ts files",
|
|
78
|
-
"temp_mod_usage": "Using a temporary directory to handle TypeScript compilation",
|
|
79
|
-
"build_failed_catch": "The build process terminated abnormally",
|
|
80
|
-
"error_message_log": "error message:",
|
|
81
|
-
"exit_with_code": "Process exits with code:",
|
|
82
|
-
"class_pri_locked": "Lock key attributes within a class",
|
|
83
|
-
"object_pri_enforced": "Setting object properties is not enumerable",
|
|
84
|
-
"no_resources": "Resource package resource not found, resource compilation skipped",
|
|
85
|
-
"ziped": "The zip compression is complete and you can directly import the game.\nThe mcaddon file is in:",
|
|
86
|
-
"tip_dist": "Packaging mode:"
|
|
87
|
-
},
|
|
88
|
-
"buildBase": {
|
|
89
|
-
"npm_deps_skipped_no_json": "npm dependency not found, skip installation",
|
|
90
|
-
"build_time": "Build time",
|
|
91
|
-
"cannot_read_project_config": "Unable to read project configuration file",
|
|
92
|
-
"invalid_project_config_format": "Project configuration file format is invalid",
|
|
93
|
-
"starting_npm_install": "Start installing npm dependencies",
|
|
94
|
-
"npm_install_completed": "Dependency installation completed",
|
|
95
|
-
"npm_install_exit_code": "npm install exit code:",
|
|
96
|
-
"npm_install_error": "npmInstall error",
|
|
97
|
-
"calculating_sha1": "Calculate file SHA1 hash value",
|
|
98
|
-
"file_not_exist": "File does not exist",
|
|
99
|
-
"config_hash_stored": "Configuration hash stored",
|
|
100
|
-
"package_hash_stored": "Packet hash stored",
|
|
101
|
-
"config_changed": "Configuration has changed",
|
|
102
|
-
"package_changed": "Package has changed",
|
|
103
|
-
"saving_current_hash": "Save current hash to cache",
|
|
104
|
-
"removing_js_files": "Remove the .js files in the script directory",
|
|
105
|
-
"removing_js_error_ignored": "Remove .js file error, ignored",
|
|
106
|
-
"removing_npm_des": "Remove npm dependency description",
|
|
107
|
-
"module_not_included": "Module not included, skip deletion",
|
|
108
|
-
"recursive_remove_js": "Recursively remove Js files",
|
|
109
|
-
"reading_file_content": "Read file contents"
|
|
110
|
-
},
|
|
111
|
-
"commands": {
|
|
112
|
-
"list": ["dev", "install", "build", "init", "version", "-v", "web_edit", "clean", "checkout", "-c", "-i", "v", "create", "recache", "lang"],
|
|
113
|
-
"dev": "mblerdev\nMonitor files and repackage when modified",
|
|
114
|
-
"build": "mbler build\nPackage the project, package the mbler project into a standard mcbe behavior package, see the document for details on the mbler project",
|
|
115
|
-
"init": "mbler init\nInitialization path configuration file, created interactively from the command line, alias: -i",
|
|
116
|
-
"version": "mbler version [null | x.x.x]\nView or set the package version of the current working directory",
|
|
117
|
-
"-c": "$checkout",
|
|
118
|
-
"-i": "$init",
|
|
119
|
-
"-v": "$v",
|
|
120
|
-
"v": "mbler [v/-v]\nCheck the version of the mbler tool itself",
|
|
121
|
-
"checkout": "mbler [checkout/-c] [null | PATH]\nView (when the second parameter is null) or switch the working directory",
|
|
122
|
-
"web_edit": "mbler web_edit\nOpen the text editor of the local HTTP working directory. It is not recommended to use during development.",
|
|
123
|
-
"create": "mbler create [npm package name | git url | path]\nAfter downloading from the specified source (with cache), create the template package in the sandbox vm, similar to npm create",
|
|
124
|
-
"recache": "mbler recache\nreset cache",
|
|
125
|
-
"lang": "mbler lang [lang name]\nSet the language, such as mbler lang zh_CN\nThe current languages are\n 1. zh 中文\n 2. en English",
|
|
126
|
-
"install": "mbler install [modulesName[]]\nWhen installing a module, the modules declared in the configuration will be scanned."
|
|
127
|
-
}
|
|
128
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={help:"MBLER\nMinecraft Bedrock Edition\nAddon Bulider In Nodejs\nnodejs build tools on bedrock version of minecraft\nSolve the problem of checking documents everywhere to configure api version\nUsage: node index.js [command]\n* You can also omit the node prefix after npm link link\nCommands: dev, install, build, init, version, -v, clean, checkout, -c, -i, v, create, recache, lang\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/",config_invalid:"Non-GameLib projects",err_bulid:"Build error",uncommand:"Invalid command",s0:"Operation successful",noGit:"Git security restrictions detected\nGit is rejecting the operation because the directory might not belong to the current user or be in a system-protected path.\nPlease select a processing method:\n\n1: Only add the current directory to the trusted zone (recommended, safe)\n2: Globally trust all directories (not recommended, but convenient)\n3: Cancel operation",SameDes:"Dependencies with the same name",invalidConfig:"Invalid configuration",inited:"Already initialized",noGitRepo:"The requested git repository was not specified and the installation failed.",invalidDes:"invalid dependency",workPackV:"Current working directory package version:",cleanFinally:"Clean build successful",noCommandTip:"Do you want to express:",init:{name:"Project name:",desc:"Project description:",useMcVersion:"Supported minecraft versions:",useSapi:"Use Script API? (Y/N)",useTs:"Using TypeScript? (Y/N)",InputFormatErr:"It is not the correct version number in x.x.x format, please re-enter it.",main:"Main script path (such as ./index.js):",useUi:"Use UI? (Y/N)",ReInput:"Not meeting specifications. Try again:"},dev:{start:"Start monitoring the build in real time. The following is the first build.",start_d:"Start an incremental build",tip:"Listen for changes:"},installGit:{NoPackage:"This GIT repository does not contain a properly configured mbler",InstallFinally:"Installation completed",HadBeen:"There is already a dependent package with the same package name. Do you want to replace it? Y/N",SetContent:"Modifying index table"},vm:{shouldNotImp:"Importing a module is prohibited because it can be used in unsafe ways",runScriptErr:"Error running script, error stack"},build:{build_info_header:"--- Build information list ---",project_path:"Project path:",output_dir:"Output directory:",minify_enabled:"Enable compression:",build_time:"Build time:",build_success:"Build successfully. Time taken:",build_failed:"Build failed",config_invalid:"Invalid configuration",package_file_missing_fields:'Missing fields: required fields ["name","description","version","mcVersion"]',script_main_entry_missing:"script is enabled, but main entry file is not specified",subpack_folder_not_found:"{id} subpackage folder does not exist, packaging failed",subpack_processing_failed:"Subpackage {id} failed to process: {error}",includes_not_array:"includes.json is not an array, skip resource copying",ts_no_files:"No .ts files found, skipping TypeScript compilation",ts_diagnostics:"{file} ({line},{character}): {message}",ts_compilation_error:"Error compiling TypeScript",no_ts_files_skip:"No .ts files found, skipping TypeScript compilation",copying_subpack_script:"Subpackage script directory copied",copying_subpack_resources:"Copying subpackage other resources",removing_js_files:"Remove the .js files in the script directory",copying_compiled_ts:"Copy the compiled TypeScript file",minification_error:"Code compression failed",temp_mod_init:"Initialize temporary module directory",script_entry_required:"script is enabled but the main entry is not set",invalid_script_entry:"The main entry file is empty or invalid",module_copy_success:"Module copied to output directory",invalid_subpack_type:"subpack is not an object, skip processing",invalid_includes_type:"includes.json is not an array, skip resource copying",handle_includes_info:"Handle includes resource copy",minification_skipped:"includes.json is not an array, skips code compression",remove_js_files_info:"Remove compiled .js files (e.g. from ts)",process_minification:"Start code compression processing",copy_compiled_ts_only:"Copy only compiled ts files",temp_mod_usage:"Using a temporary directory to handle TypeScript compilation",build_failed_catch:"The build process terminated abnormally",error_message_log:"error message:",exit_with_code:"Process exits with code:",class_pri_locked:"Lock key attributes within a class",object_pri_enforced:"Setting object properties is not enumerable",no_resources:"Resource package resource not found, resource compilation skipped",ziped:"The zip compression is complete and you can directly import the game.\nThe mcaddon file is in:",tip_dist:"Packaging mode:"},buildBase:{npm_deps_skipped_no_json:"npm dependency not found, skip installation",build_time:"Build time",cannot_read_project_config:"Unable to read project configuration file",invalid_project_config_format:"The project configuration file format is invalid",starting_npm_install:"Start installing npm dependencies",npm_install_completed:"Dependency installation completed",npm_install_exit_code:"npm install exit code:",npm_install_error:"npmInstall error",calculating_sha1:"Calculate file SHA1 hash value",file_not_exist:"File does not exist",config_hash_stored:"Configuration hash stored",package_hash_stored:"Packet hash stored",config_changed:"Configuration has changed",package_changed:"Package has changed",saving_current_hash:"Save current hash to cache",removing_js_files:"Remove the .js files in the script directory",removing_js_error_ignored:"Remove .js file error, ignored",removing_npm_des:"Remove npm dependency description",module_not_included:"Module not included, skip deletion",recursive_remove_js:"Recursively remove Js files",reading_file_content:"Read file contents"},commands:{list:{0:"dev",1:"install",2:"build",3:"init",4:"version",5:"-v",6:"clean",7:"checkout",8:"-c",9:"-i",10:"v",11:"create",12:"recache",13:"lang"},dev:"mblerdev\nMonitor files and repackage when modified",build:"mbler build\nPackage the project, package the mbler project into a standard mcbe behavior package, see the document for details on the mbler project",init:"mbler init\nInitialization path configuration file, created interactively from the command line, alias: -i",version:"mbler version [null | x.x.x]\nView or set the package version of the current working directory","-c":"$checkout","-i":"$init","-v":"$v",v:"mbler [v/-v]\nCheck the version of the mbler tool itself",checkout:"mbler [checkout/-c] [null | PATH]\nView (when the second parameter is null) or switch the working directory",create:"mbler create [npm package name | git url | path]\nAfter downloading from the specified source (with cache), create the template package in the sandbox vm, similar to npm create",recache:"mbler recache\nreset cache",lang:"mbler lang [lang name]\nSet the language, such as mbler lang zh_CN\nThe current languages are\n 1. zh 中文\n 2. en English",install:"mbler install [modulesName[]]\nWhen installing a module, the modules declared in the configuration will be scanned."}};
|
package/lib/lang/index.js
CHANGED
|
@@ -1,78 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cleanFinally = cleanFinally;
|
|
7
|
-
exports.s0 = s0;
|
|
8
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
-
const zh_js_1 = __importDefault(require("./zh.js"));
|
|
10
|
-
const en_js_1 = __importDefault(require("./en.js"));
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const langs = ["zh", "en"];
|
|
13
|
-
const configPath = node_path_1.default.join(require("node:os").homedir(), ".cache/mbler/.lang.db");
|
|
14
|
-
class Lang {
|
|
15
|
-
currenyLang = "zh";
|
|
16
|
-
init() {
|
|
17
|
-
try {
|
|
18
|
-
const TheyLang = node_fs_1.default.readFileSync(configPath, "utf-8").toString().trim();
|
|
19
|
-
if (TheyLang == "zh" || TheyLang == "en") {
|
|
20
|
-
this.currenyLang = TheyLang;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
throw new Error("[setup lang]: set lang error");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
this.currenyLang = "zh";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
set(newLang) {
|
|
31
|
-
if (langs.includes(newLang)) {
|
|
32
|
-
if (!node_fs_1.default.existsSync(configPath)) {
|
|
33
|
-
node_fs_1.default.mkdirSync(node_path_1.default.dirname(configPath), {
|
|
34
|
-
recursive: true
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
node_fs_1.default.writeFileSync(configPath, newLang);
|
|
38
|
-
this.currenyLang = newLang;
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
async get() {
|
|
44
|
-
try {
|
|
45
|
-
if (this.currenyLang == "zh")
|
|
46
|
-
return zh_js_1.default;
|
|
47
|
-
return en_js_1.default;
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return zh_js_1.default;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
let exp = {};
|
|
55
|
-
async function Export(lang) {
|
|
56
|
-
const obj = await lang.get();
|
|
57
|
-
// 用原型来让导入后切换语言不需要再次导入,相同引用
|
|
58
|
-
Object.setPrototypeOf(exp, {
|
|
59
|
-
...obj,
|
|
60
|
-
__internal: {
|
|
61
|
-
class: lang,
|
|
62
|
-
set: (newLang) => {
|
|
63
|
-
lang.set(newLang);
|
|
64
|
-
Export(lang);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
const lang = new Lang();
|
|
70
|
-
lang.init();
|
|
71
|
-
Export(lang);
|
|
72
|
-
exports.default = exp;
|
|
73
|
-
function cleanFinally(arg0, cleanFinally) {
|
|
74
|
-
throw new Error('Function not implemented.');
|
|
75
|
-
}
|
|
76
|
-
function s0(s0) {
|
|
77
|
-
throw new Error('Function not implemented.');
|
|
78
|
-
}
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const node_fs_1=__importDefault(require("node:fs")),zh_js_1=__importDefault(require("./zh.js")),en_js_1=__importDefault(require("./en.js")),node_path_1=__importDefault(require("node:path")),langs=["zh","en"],configPath=node_path_1.default.join(require("node:os").homedir(),".cache/mbler/.lang.db");class Lang{currenyLang="zh";init(){try{const e=node_fs_1.default.readFileSync(configPath,"utf-8").toString().trim();if("zh"!=e&&"en"!=e)throw new Error("[setup lang]: set lang error");this.currenyLang=e}catch{this.currenyLang="zh"}}set(e){return!!langs.includes(e)&&(node_fs_1.default.existsSync(configPath)||node_fs_1.default.mkdirSync(node_path_1.default.dirname(configPath),{recursive:!0}),node_fs_1.default.writeFileSync(configPath,e),this.currenyLang=e,!0)}async get(){try{return"zh"==this.currenyLang?zh_js_1.default:en_js_1.default}catch{return zh_js_1.default}}}let exp={};async function Export(e){const t=await e.get();Object.setPrototypeOf(exp,{...t,__internal:{class:e,set:t=>{e.set(t),Export(e)}}})}const lang=new Lang;lang.init(),Export(lang),exports.default=exp;
|
package/lib/lang/zh.js
CHANGED
|
@@ -1,146 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cmdList = ["dev", "install", "build", "init", "version", "-v", "web_edit", "clean", "checkout", "-c", "-i", "v", "create", "recache", "lang"];
|
|
4
|
-
exports.default = {
|
|
5
|
-
help: `MBLER
|
|
6
|
-
Minecraft Bedrock Edition
|
|
7
|
-
Addon Bulider In Nodejs
|
|
8
|
-
在基岩版我的世界上的 nodejs 构建工具
|
|
9
|
-
解决到处查文档配置 api 版本的难题
|
|
10
|
-
用法: node index.js [command]
|
|
11
|
-
* 也可以 npm link 链接后省略 node 前缀
|
|
12
|
-
命令 : ${cmdList.join(", ")}
|
|
13
|
-
帮助命令 :
|
|
14
|
-
help
|
|
15
|
-
显示帮助信息
|
|
16
|
-
第二个参数为要查询的命令名称或空
|
|
17
|
-
别名: -h, -help
|
|
18
|
-
git https://github.com/RuanhoR/mbler/`,
|
|
19
|
-
config_invalid: "非 GameLib 项目",
|
|
20
|
-
err_bulid: "构建错误",
|
|
21
|
-
uncommand: "无效的命令",
|
|
22
|
-
s0: "操作成功 ",
|
|
23
|
-
noGit: '\n检测到 Git 安全限制\nGit 拒绝操作,因为该目录可能不属于当前用户或位于系统保护路径。\n请选择处理方式:\n\n1 : 仅将当前目录加入可信区(推荐,安全)\n2 : 全局信任所有目录(不推荐,但方便)\n3 : 取消操作',
|
|
24
|
-
SameDes: "同名的依赖",
|
|
25
|
-
invalidConfig: "无效的配置",
|
|
26
|
-
inited: "已经初始化过了",
|
|
27
|
-
noGitRepo: '没有指定索取的git仓库,安装失败',
|
|
28
|
-
invalidDes: '无效的依赖',
|
|
29
|
-
workPackV: "当前工作目录包版本:",
|
|
30
|
-
cleanFinally: "清理构建版本成功",
|
|
31
|
-
noCommandTip: "你是否想表达 : ",
|
|
32
|
-
init: {
|
|
33
|
-
name: "项目名称 : ",
|
|
34
|
-
desc: "项目描述 : ",
|
|
35
|
-
useMcVersion: "支持的minecraft版本 : ",
|
|
36
|
-
useSapi: "使用Script Api吗?(Y/N) ",
|
|
37
|
-
useTs: "使用TypeScript吗?(Y/N) ",
|
|
38
|
-
InputFormatErr: "不是正确的x.x.x格式版本号,重新输入\n ",
|
|
39
|
-
main: "主脚本路径(如 ./index.js): ",
|
|
40
|
-
useUi: "使用 UI 吗?(Y/N) ",
|
|
41
|
-
ReInput: '不符合规范 重试:\n '
|
|
42
|
-
},
|
|
43
|
-
dev: {
|
|
44
|
-
start: "开始即时监听构建 以下为第一次构建",
|
|
45
|
-
start_d: "开始增量构建",
|
|
46
|
-
tip: "监听到变化 : "
|
|
47
|
-
},
|
|
48
|
-
installGit: {
|
|
49
|
-
NoPackage: `此 GIT 库未包含正确配置mbler`,
|
|
50
|
-
InstallFinally: '安装完成',
|
|
51
|
-
HadBeen: '已有相同包名依赖包,是否替换? Y/N',
|
|
52
|
-
SetContent: '正在修改索引表'
|
|
53
|
-
},
|
|
54
|
-
vm: {
|
|
55
|
-
shouldNotImp: "禁止导入模块,因为该模块可以用于不安全举动",
|
|
56
|
-
runScriptErr: "运行脚本出错,错误栈 "
|
|
57
|
-
},
|
|
58
|
-
build: {
|
|
59
|
-
build_info_header: '--- 构建信息一览表 ---',
|
|
60
|
-
project_path: '项目路径:',
|
|
61
|
-
output_dir: '输出目录:',
|
|
62
|
-
minify_enabled: '启用压缩:',
|
|
63
|
-
build_time: '构建时间:',
|
|
64
|
-
// 构建状态
|
|
65
|
-
build_success: '构建成功 耗时 :',
|
|
66
|
-
build_failed: '构建失败',
|
|
67
|
-
// 配置与校验
|
|
68
|
-
config_invalid: '配置无效',
|
|
69
|
-
package_file_missing_fields: `字段缺失:必需字段 ${JSON.stringify(['name', 'description', 'version', 'mcVersion'])}`,
|
|
70
|
-
script_main_entry_missing: '启用了 script,但未指定 main 入口文件',
|
|
71
|
-
subpack_folder_not_found: '{id} 子包文件夹不存在,打包失败',
|
|
72
|
-
subpack_processing_failed: `子包 {id} 处理失败: {error}`,
|
|
73
|
-
includes_not_array: 'includes.json 不是数组,跳过资源复制',
|
|
74
|
-
// 警告/错误日志常用语
|
|
75
|
-
ts_no_files: '未发现任何 .ts 文件,跳过 TypeScript 编译',
|
|
76
|
-
ts_diagnostics: '{file} ({line},{character}): {message}',
|
|
77
|
-
ts_compilation_error: '编译 TypeScript 时出错',
|
|
78
|
-
// 其他日志/提示
|
|
79
|
-
no_ts_files_skip: '未发现任何 .ts 文件,跳过 TypeScript 编译',
|
|
80
|
-
copying_subpack_script: '已复制子包脚本目录',
|
|
81
|
-
copying_subpack_resources: '正在复制子包其他资源',
|
|
82
|
-
removing_js_files: '移除脚本目录中的 .js 文件',
|
|
83
|
-
copying_compiled_ts: '复制编译后的 TypeScript 文件',
|
|
84
|
-
minification_error: '代码压缩失败',
|
|
85
|
-
temp_mod_init: '初始化临时模块目录',
|
|
86
|
-
script_entry_required: 'script 启用但未设置 main 入口',
|
|
87
|
-
invalid_script_entry: 'main 入口文件为空或无效',
|
|
88
|
-
module_copy_success: '模块已复制到输出目录',
|
|
89
|
-
invalid_subpack_type: 'subpack 不是对象,跳过处理',
|
|
90
|
-
invalid_includes_type: 'includes.json 不是数组,跳过资源复制',
|
|
91
|
-
handle_includes_info: '处理 includes 资源拷贝',
|
|
92
|
-
minification_skipped: 'includes.json 非数组,跳过代码压缩',
|
|
93
|
-
remove_js_files_info: '移除编译出的 .js 文件(如来自 ts)',
|
|
94
|
-
process_minification: '开始代码压缩处理',
|
|
95
|
-
copy_compiled_ts_only: '仅复制编译后的 ts 文件',
|
|
96
|
-
temp_mod_usage: '使用临时目录处理 TypeScript 编译',
|
|
97
|
-
build_failed_catch: '构建流程异常终止',
|
|
98
|
-
error_message_log: '错误信息: ',
|
|
99
|
-
exit_with_code: '进程退出,代码: ',
|
|
100
|
-
class_pri_locked: '锁定类内关键属性',
|
|
101
|
-
object_pri_enforced: '设置对象属性不可枚举',
|
|
102
|
-
no_resources: "没找到资源包资源,跳过资源编译",
|
|
103
|
-
ziped: "zip 压缩完成,你可以直接导入游戏啦\nmcaddon文件在 : ",
|
|
104
|
-
tip_dist: "打包模式 :"
|
|
105
|
-
},
|
|
106
|
-
buildBase: {
|
|
107
|
-
npm_deps_skipped_no_json: "没有找到npm依赖,跳过安装",
|
|
108
|
-
build_time: '构建时间',
|
|
109
|
-
cannot_read_project_config: '无法读取项目配置文件',
|
|
110
|
-
invalid_project_config_format: '项目配置文件格式无效',
|
|
111
|
-
starting_npm_install: '开始安装 npm 依赖',
|
|
112
|
-
npm_install_completed: '依赖安装完成',
|
|
113
|
-
npm_install_exit_code: 'npm install 退出码:',
|
|
114
|
-
npm_install_error: 'npmInstall 错误',
|
|
115
|
-
calculating_sha1: '计算文件 SHA1 哈希值',
|
|
116
|
-
file_not_exist: '文件不存在',
|
|
117
|
-
config_hash_stored: '配置哈希已存储',
|
|
118
|
-
package_hash_stored: '包哈希已存储',
|
|
119
|
-
config_changed: '配置已变更',
|
|
120
|
-
package_changed: '包已变更',
|
|
121
|
-
saving_current_hash: '保存当前哈希到缓存',
|
|
122
|
-
removing_js_files: '移除脚本目录中的 .js 文件',
|
|
123
|
-
removing_js_error_ignored: '移除 .js 文件错误,已忽略',
|
|
124
|
-
removing_npm_des: '移除 npm 依赖描述',
|
|
125
|
-
module_not_included: '模块未包含,跳过删除',
|
|
126
|
-
recursive_remove_js: '递归移除 Js 文件',
|
|
127
|
-
reading_file_content: '读取文件内容'
|
|
128
|
-
},
|
|
129
|
-
commands: {
|
|
130
|
-
list: cmdList,
|
|
131
|
-
dev: "mbler dev \n监听文件,在修改时重打包",
|
|
132
|
-
build: "mbler build \n打包项目,把mbler项目打包成标准mcbe行为包,mbler项目介绍详见文档",
|
|
133
|
-
init: `mbler init \n初始化路径的配置文件,以命令行交互式创建,别名: -i`,
|
|
134
|
-
version: "mbler version [null | x.x.x] \n查看或设置当前工作目录的包版本",
|
|
135
|
-
"-c": "$checkout",
|
|
136
|
-
"-i": "$init",
|
|
137
|
-
"-v": "$v",
|
|
138
|
-
v: "mbler [v/-v] \n查看mbler工具本身的版本",
|
|
139
|
-
checkout: "mbler [checkout/-c] [null | PATH]\n查看(当第二个参数为null时)或切换工作目录",
|
|
140
|
-
"web_edit": "mbler web_edit \n开启本地 HTTP 工作目录的文本编辑器,开发中不建议食用",
|
|
141
|
-
create: "mbler create [npm package name | git url | path]\n从指定源下载后(有缓存)进行在沙盒vm内的创建模板包,类似npm create",
|
|
142
|
-
recache: "mbler recache \n重置缓存",
|
|
143
|
-
lang: "mbler lang [lang name] \n设置语言,如 mbler lang zh_CN\n目前语言有 \n 1. zh 中文 \n 2. en 英文",
|
|
144
|
-
install: "mbler install [modulesName[]]\n安装模块,会顺便扫描配置中声明的模块"
|
|
145
|
-
}
|
|
146
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const cmdList=["dev","install","build","init","version","-v","clean","checkout","-c","-i","v","create","recache","lang"];exports.default={help:`MBLER\nMinecraft Bedrock Edition\nAddon Bulider In Nodejs\n在基岩版我的世界上的 nodejs 构建工具\n解决到处查文档配置 api 版本的难题\n用法: node index.js [command]\n* 也可以 npm link 链接后省略 node 前缀\n命令 : ${cmdList.join(", ")}\n帮助命令 : \n help\n 显示帮助信息\n 第二个参数为要查询的命令名称或空\n 别名: -h, -help\n git https://github.com/RuanhoR/mbler/`,config_invalid:"非 GameLib 项目",err_bulid:"构建错误",uncommand:"无效的命令",s0:"操作成功 ",noGit:"\n检测到 Git 安全限制\nGit 拒绝操作,因为该目录可能不属于当前用户或位于系统保护路径。\n请选择处理方式:\n\n1 : 仅将当前目录加入可信区(推荐,安全)\n2 : 全局信任所有目录(不推荐,但方便)\n3 : 取消操作",SameDes:"同名的依赖",invalidConfig:"无效的配置",inited:"已经初始化过了",noGitRepo:"没有指定索取的git仓库,安装失败",invalidDes:"无效的依赖",workPackV:"当前工作目录包版本:",cleanFinally:"清理构建版本成功",noCommandTip:"你是否想表达 : ",init:{name:"项目名称 : ",desc:"项目描述 : ",useMcVersion:"支持的minecraft版本 : ",useSapi:"使用Script Api吗?(Y/N) ",useTs:"使用TypeScript吗?(Y/N) ",InputFormatErr:"不是正确的x.x.x格式版本号,重新输入\n ",main:"主脚本路径(如 ./index.js): ",useUi:"使用 UI 吗?(Y/N) ",ReInput:"不符合规范 重试:\n "},dev:{start:"开始即时监听构建 以下为第一次构建",start_d:"开始增量构建",tip:"监听到变化 : "},installGit:{NoPackage:"此 GIT 库未包含正确配置mbler",InstallFinally:"安装完成",HadBeen:"已有相同包名依赖包,是否替换? Y/N",SetContent:"正在修改索引表"},vm:{shouldNotImp:"禁止导入模块,因为该模块可以用于不安全举动",runScriptErr:"运行脚本出错,错误栈 "},build:{build_info_header:"--- 构建信息一览表 ---",project_path:"项目路径:",output_dir:"输出目录:",minify_enabled:"启用压缩:",build_time:"构建时间:",build_success:"构建成功 耗时 :",build_failed:"构建失败",config_invalid:"配置无效",package_file_missing_fields:`字段缺失:必需字段 ${JSON.stringify(["name","description","version","mcVersion"])}`,script_main_entry_missing:"启用了 script,但未指定 main 入口文件",subpack_folder_not_found:"{id} 子包文件夹不存在,打包失败",subpack_processing_failed:"子包 {id} 处理失败: {error}",includes_not_array:"includes.json 不是数组,跳过资源复制",ts_no_files:"未发现任何 .ts 文件,跳过 TypeScript 编译",ts_diagnostics:"{file} ({line},{character}): {message}",ts_compilation_error:"编译 TypeScript 时出错",no_ts_files_skip:"未发现任何 .ts 文件,跳过 TypeScript 编译",copying_subpack_script:"已复制子包脚本目录",copying_subpack_resources:"正在复制子包其他资源",removing_js_files:"移除脚本目录中的 .js 文件",copying_compiled_ts:"复制编译后的 TypeScript 文件",minification_error:"代码压缩失败",temp_mod_init:"初始化临时模块目录",script_entry_required:"script 启用但未设置 main 入口",invalid_script_entry:"main 入口文件为空或无效",module_copy_success:"模块已复制到输出目录",invalid_subpack_type:"subpack 不是对象,跳过处理",invalid_includes_type:"includes.json 不是数组,跳过资源复制",handle_includes_info:"处理 includes 资源拷贝",minification_skipped:"includes.json 非数组,跳过代码压缩",remove_js_files_info:"移除编译出的 .js 文件(如来自 ts)",process_minification:"开始代码压缩处理",copy_compiled_ts_only:"仅复制编译后的 ts 文件",temp_mod_usage:"使用临时目录处理 TypeScript 编译",build_failed_catch:"构建流程异常终止",error_message_log:"错误信息: ",exit_with_code:"进程退出,代码: ",class_pri_locked:"锁定类内关键属性",object_pri_enforced:"设置对象属性不可枚举",no_resources:"没找到资源包资源,跳过资源编译",ziped:"zip 压缩完成,你可以直接导入游戏啦\nmcaddon文件在 : ",tip_dist:"打包模式 :"},buildBase:{npm_deps_skipped_no_json:"没有找到npm依赖,跳过安装",build_time:"构建时间",cannot_read_project_config:"无法读取项目配置文件",invalid_project_config_format:"项目配置文件格式无效",starting_npm_install:"开始安装 npm 依赖",npm_install_completed:"依赖安装完成",npm_install_exit_code:"npm install 退出码:",npm_install_error:"npmInstall 错误",calculating_sha1:"计算文件 SHA1 哈希值",file_not_exist:"文件不存在",config_hash_stored:"配置哈希已存储",package_hash_stored:"包哈希已存储",config_changed:"配置已变更",package_changed:"包已变更",saving_current_hash:"保存当前哈希到缓存",removing_js_files:"移除脚本目录中的 .js 文件",removing_js_error_ignored:"移除 .js 文件错误,已忽略",removing_npm_des:"移除 npm 依赖描述",module_not_included:"模块未包含,跳过删除",recursive_remove_js:"递归移除 Js 文件",reading_file_content:"读取文件内容"},commands:{list:cmdList,dev:"mbler dev \n监听文件,在修改时重打包",build:"mbler build \n打包项目,把mbler项目打包成标准mcbe行为包,mbler项目介绍详见文档",init:"mbler init \n初始化路径的配置文件,以命令行交互式创建,别名: -i",version:"mbler version [null | x.x.x] \n查看或设置当前工作目录的包版本","-c":"$checkout","-i":"$init","-v":"$v",v:"mbler [v/-v] \n查看mbler工具本身的版本",checkout:"mbler [checkout/-c] [null | PATH]\n查看(当第二个参数为null时)或切换工作目录",web_edit:"mbler web_edit \n开启本地 HTTP 工作目录的文本编辑器,开发中不建议食用",create:"mbler create [npm package name | git url | path]\n从指定源下载后(有缓存)进行在沙盒vm内的创建模板包,类似npm create",recache:"mbler recache \n重置缓存",lang:"mbler lang [lang name] \n设置语言,如 mbler lang zh_CN\n目前语言有 \n 1. zh 中文 \n 2. en 英文",install:"mbler install [modulesName[]]\n安装模块,会顺便扫描配置中声明的模块"}};
|
package/lib/loger/colors.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.white = exports.cyan = exports.yellow = exports.red = exports.reset = void 0;
|
|
4
|
-
const reset = "\x1b[0m";
|
|
5
|
-
exports.reset = reset;
|
|
6
|
-
const red = "\x1b[31m";
|
|
7
|
-
exports.red = red;
|
|
8
|
-
const yellow = "\x1b[33m";
|
|
9
|
-
exports.yellow = yellow;
|
|
10
|
-
const cyan = "\x1b[36m";
|
|
11
|
-
exports.cyan = cyan;
|
|
12
|
-
const white = "\x1b[37m";
|
|
13
|
-
exports.white = white;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.white=exports.cyan=exports.yellow=exports.red=exports.reset=void 0;const reset="[0m";exports.reset=reset;const red="[31m";exports.red=red;const yellow="[33m";exports.yellow=yellow;const cyan="[36m";exports.cyan=cyan;const white="[37m";exports.white=white;
|
package/lib/loger/index.js
CHANGED
|
@@ -1,136 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const colors_js_1 = require("./colors.js");
|
|
40
|
-
const util_1 = __importDefault(require("util"));
|
|
41
|
-
const utils = __importStar(require("./../utils/index.js"));
|
|
42
|
-
/**
|
|
43
|
-
* 日志级别
|
|
44
|
-
* @readonly
|
|
45
|
-
* @enum {string}
|
|
46
|
-
*/
|
|
47
|
-
const LEVELS = {
|
|
48
|
-
ERROR: 'ERROR',
|
|
49
|
-
WARN: 'WARN',
|
|
50
|
-
INFO: 'INFO',
|
|
51
|
-
DEBUG: 'DEBUG'
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* 日志颜色
|
|
55
|
-
* @readonly
|
|
56
|
-
* @type {Object<string, string>}
|
|
57
|
-
*/
|
|
58
|
-
const LEVEL_COLORS = {
|
|
59
|
-
[LEVELS.ERROR]: colors_js_1.red,
|
|
60
|
-
[LEVELS.WARN]: colors_js_1.yellow,
|
|
61
|
-
[LEVELS.INFO]: colors_js_1.white,
|
|
62
|
-
[LEVELS.DEBUG]: colors_js_1.cyan
|
|
63
|
-
};
|
|
64
|
-
class Logger {
|
|
65
|
-
[util_1.default.inspect.custom] = this.toString;
|
|
66
|
-
/**
|
|
67
|
-
* 打印日志
|
|
68
|
-
* @private
|
|
69
|
-
* @param {string} tag - 日志标签
|
|
70
|
-
* @param {string} level - 日志级别
|
|
71
|
-
* @param {string} color - 颜色前缀
|
|
72
|
-
* @param {Array<*>} msgs - 日志内容
|
|
73
|
-
*/
|
|
74
|
-
#print(tag, level, color, msgs) {
|
|
75
|
-
const time = new Date().toISOString();
|
|
76
|
-
const msgStr = utils.toString(msgs);
|
|
77
|
-
this.getConsole(level.toLowerCase(), `${color}[${level}] [${tag}] ${time}: ${msgStr} ${colors_js_1.reset}`);
|
|
78
|
-
}
|
|
79
|
-
getConsole(type, t) {
|
|
80
|
-
switch (type) {
|
|
81
|
-
case "error":
|
|
82
|
-
console.error(t);
|
|
83
|
-
break;
|
|
84
|
-
case "info":
|
|
85
|
-
console.info(t);
|
|
86
|
-
break;
|
|
87
|
-
case "warn":
|
|
88
|
-
console.warn(t);
|
|
89
|
-
break;
|
|
90
|
-
case "debug":
|
|
91
|
-
console.debug(t);
|
|
92
|
-
break;
|
|
93
|
-
default:
|
|
94
|
-
console.info(t);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* 错误日志
|
|
99
|
-
* @param {string} tag - 日志标签
|
|
100
|
-
* @param {...*} msgs - 日志内容
|
|
101
|
-
*/
|
|
102
|
-
e(tag, ...msgs) {
|
|
103
|
-
this.#print(tag, LEVELS.ERROR, LEVEL_COLORS[LEVELS.ERROR], msgs);
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* 警告日志
|
|
107
|
-
* @param {string} tag - 日志标签
|
|
108
|
-
* @param {...*} msgs - 日志内容
|
|
109
|
-
*/
|
|
110
|
-
w(tag, ...msgs) {
|
|
111
|
-
this.#print(tag, LEVELS.WARN, LEVEL_COLORS[LEVELS.WARN], msgs);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* 信息日志
|
|
115
|
-
* @param {string} tag - 日志标签
|
|
116
|
-
* @param {...*} msgs - 日志内容
|
|
117
|
-
*/
|
|
118
|
-
i(tag, ...msgs) {
|
|
119
|
-
this.#print(tag, LEVELS.INFO, LEVEL_COLORS[LEVELS.INFO], msgs);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 调试日志
|
|
123
|
-
* @param {string} tag - 日志标签
|
|
124
|
-
* @param {...*} msgs - 日志内容
|
|
125
|
-
*/
|
|
126
|
-
d(tag, ...msgs) {
|
|
127
|
-
this.#print(tag, LEVELS.DEBUG, LEVEL_COLORS[LEVELS.DEBUG], msgs);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @returns {string}
|
|
131
|
-
*/
|
|
132
|
-
toString() {
|
|
133
|
-
return '[object Logger]';
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
exports.default = new Logger();
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,i)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var o=e(t),i=0;i<o.length;i++)"default"!==o[i]&&__createBinding(r,t,o[i]);return __setModuleDefault(r,t),r}}(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const colors_js_1=require("./colors.js"),util_1=__importDefault(require("util")),utils=__importStar(require("./../utils/index.js")),LEVELS={ERROR:"ERROR",WARN:"WARN",INFO:"INFO",DEBUG:"DEBUG"},LEVEL_COLORS={[LEVELS.ERROR]:colors_js_1.red,[LEVELS.WARN]:colors_js_1.yellow,[LEVELS.INFO]:colors_js_1.white,[LEVELS.DEBUG]:colors_js_1.cyan};class Logger{[util_1.default.inspect.custom]=this.toString;#e(e,t,r,o){const i=(new Date).toISOString(),n=utils.toString(o);this.getConsole(t.toLowerCase(),`${r}[${t}] [${e}] ${i}: ${n} ${colors_js_1.reset}`)}getConsole(e,t){switch(e){case"error":console.error(t);break;case"info":default:console.info(t);break;case"warn":console.warn(t);break;case"debug":console.debug(t)}}e(e,...t){this.#e(e,LEVELS.ERROR,LEVEL_COLORS[LEVELS.ERROR],t)}w(e,...t){this.#e(e,LEVELS.WARN,LEVEL_COLORS[LEVELS.WARN],t)}i(e,...t){this.#e(e,LEVELS.INFO,LEVEL_COLORS[LEVELS.INFO],t)}d(e,...t){this.#e(e,LEVELS.DEBUG,LEVEL_COLORS[LEVELS.DEBUG],t)}toString(){return"[object Logger]"}}exports.default=new Logger;
|
package/lib/mcx/ast/index.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const tag_js_1 = __importDefault(require("./tag.js"));
|
|
7
|
-
const prop_js_1 = __importDefault(require("./prop.js"));
|
|
8
|
-
exports.default = {
|
|
9
|
-
tag: tag_js_1.default,
|
|
10
|
-
prop: prop_js_1.default
|
|
11
|
-
};
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});const tag_js_1=__importDefault(require("./tag.js")),prop_js_1=__importDefault(require("./prop.js"));exports.default={tag:tag_js_1.default,prop:prop_js_1.default};
|
package/lib/mcx/ast/prop.js
CHANGED
|
@@ -1,78 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Lexer = void 0;
|
|
4
|
-
exports.default = PropParser;
|
|
5
|
-
const STATUS = [0, 1]; // 0: 搜集 key,1: 搜集 value
|
|
6
|
-
class Lexer {
|
|
7
|
-
code;
|
|
8
|
-
constructor(code) {
|
|
9
|
-
this.code = code;
|
|
10
|
-
}
|
|
11
|
-
// 对外暴露的 tokenize 方法(生成器函数)
|
|
12
|
-
*tokenize() {
|
|
13
|
-
let currStatus = STATUS[0]; // 0: key,1: value
|
|
14
|
-
let key = "";
|
|
15
|
-
let value = "";
|
|
16
|
-
let hasEquals = false;
|
|
17
|
-
for (const char of this.code) {
|
|
18
|
-
if (/\s/.test(char)) {
|
|
19
|
-
if (char === '\n') {
|
|
20
|
-
if (currStatus === STATUS[1] && key && value) {
|
|
21
|
-
const propNode = {
|
|
22
|
-
key,
|
|
23
|
-
value: this.HandlerValue(value),
|
|
24
|
-
type: "PropChar"
|
|
25
|
-
};
|
|
26
|
-
yield propNode;
|
|
27
|
-
}
|
|
28
|
-
else if (currStatus === STATUS[0] && key) { }
|
|
29
|
-
key = "";
|
|
30
|
-
value = "";
|
|
31
|
-
hasEquals = false;
|
|
32
|
-
currStatus = STATUS[0];
|
|
33
|
-
}
|
|
34
|
-
continue; // 跳过所有空白字符
|
|
35
|
-
}
|
|
36
|
-
if (char === '=') {
|
|
37
|
-
if (currStatus === STATUS[0]) {
|
|
38
|
-
currStatus = STATUS[1]; // 切换到 value 状态
|
|
39
|
-
hasEquals = true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
if (currStatus === STATUS[0]) {
|
|
44
|
-
key += char; // 搜集 key
|
|
45
|
-
}
|
|
46
|
-
else if (currStatus === STATUS[1]) {
|
|
47
|
-
value += char; // 搜集 value
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (key && value) {
|
|
52
|
-
const propNode = {
|
|
53
|
-
key,
|
|
54
|
-
value: this.HandlerValue(value),
|
|
55
|
-
type: "PropChar"
|
|
56
|
-
};
|
|
57
|
-
yield propNode;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
HandlerValue(value) {
|
|
61
|
-
try {
|
|
62
|
-
const num = Number(value);
|
|
63
|
-
if (!Number.isNaN(num))
|
|
64
|
-
return num;
|
|
65
|
-
if (["[", "{"].includes(value.slice(0, 1)) && ["]", "}"].includes(value.slice(-1))) {
|
|
66
|
-
return JSON.parse(value);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch { }
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.Lexer = Lexer;
|
|
74
|
-
// 默认导出解析函数
|
|
75
|
-
function PropParser(code) {
|
|
76
|
-
const lexer = new Lexer(code);
|
|
77
|
-
return Array.from(lexer.tokenize());
|
|
78
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Lexer=void 0,exports.default=PropParser;const STATUS=[0,1];class Lexer{code;constructor(e){this.code=e}*tokenize(){let e=STATUS[0],r="",t="",s=!1;for(const o of this.code)if(/\s/.test(o)){if("\n"===o){if(e===STATUS[1]&&r&&t){const e={key:r,value:this.HandlerValue(t),type:"PropChar"};yield e}r="",t="",s=!1,e=STATUS[0]}}else"="===o?e===STATUS[0]&&(e=STATUS[1],s=!0):e===STATUS[0]?r+=o:e===STATUS[1]&&(t+=o);if(r&&t){const e={key:r,value:this.HandlerValue(t),type:"PropChar"};yield e}}HandlerValue(e){try{const r=Number(e);if(!Number.isNaN(r))return r;if(["[","{"].includes(e.slice(0,1))&&["]","}"].includes(e.slice(-1)))return JSON.parse(e)}catch{}return e}}function PropParser(e){const r=new Lexer(e);return Array.from(r.tokenize())}exports.Lexer=Lexer;
|