mbler 0.2.8-rc.1 → 0.2.8-rc.2

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/README.md CHANGED
@@ -1,48 +1,131 @@
1
1
  # MBLER
2
2
 
3
- ### Introduction
3
+ [![CI](https://github.com/RuanhoR/mbler/actions/workflows/lint.yml/badge.svg)](https://github.com/RuanhoR/mbler/actions/workflows/lint.yml)
4
+ [![npm](https://img.shields.io/npm/v/mbler)](https://npmjs.com/package/mbler)
5
+ [![License](https://img.shields.io/github/license/RuanhoR/mbler)](LICENSE)
6
+ [![Node](https://img.shields.io/node/v/mbler)](https://nodejs.org)
7
+ [![Gitee](https://img.shields.io/badge/Gitee-mirror-red)](https://gitee.com/n304sc-haoran/mbler.git)
4
8
 
5
- A development tool for Minecraft Addon based on Rolldown, featuring:
9
+ A development toolchain for Minecraft Bedrock Edition Addons, built on [Rolldown](https://rolldown.rs).
6
10
 
7
- - MCX DSL
8
- - Manifest Generator
9
- - Bundle
10
- - Component build
11
+ ## Features
11
12
 
12
- ## About repo
13
+ - **MCX DSL** — Domain-specific language for Minecraft scripting with type safety
14
+ - **Manifest Generator** — Auto-generates `manifest.json` with deterministic UUIDs and module dependencies
15
+ - **Bundle** — Bundles scripts into single ESM files via Rolldown, with auto-externalization of Minecraft APIs
16
+ - **Component build** — Asset import support (`.png`, `.svg`, etc.) via MCX image components
17
+ - **Watch mode** — Incremental rebuild & file-copy on change via `mbler watch`
18
+ - **Minification** — Supports `oxc` (default), `terser`, and `esbuild` minifiers
19
+ - **Build cache** — Configurable caching (none/memory/file/filesystem/auto) for faster rebuilds
20
+ - **Release packaging** — Build `.mcaddon` archives via `BUILD_MODULE=release` environment variable
21
+ - **PMNX Marketplace** — Publish, install, uninstall, and manage addon packages
22
+ - **i18n** — Built-in internationalization (English & Chinese)
23
+ - **`mcx-tsc`** — Standalone MCX type-checker binary
13
24
 
14
- [MCX CORE](https://github.com/RuanhoR/mcx-core) | [MCX Language Server](https://github.com/RuanhoR/mcx-language-server) | [MCX Template](https://github.com/RuanhoR/mcx-template) | [MNX Market](https://github.com/RuanhoR/mnx)
25
+ ## Installation
15
26
 
16
- ### Installation
17
-
18
- Ensure you have the following tools installed:
19
-
20
- - Node.js and npm
21
- - Git
27
+ **Prerequisites:** Node.js >= 20.0.0, pnpm (recommended) or npm
22
28
 
23
29
  ```bash
24
30
  npm install -g mbler
25
31
  ```
26
32
 
27
- After installation, you can use it directly:
33
+ ## Quick Start
28
34
 
29
35
  ```bash
30
- # Get version
31
- mbler -v
32
- ```
36
+ pnpm create mbler
33
37
 
34
- Initialize directory configuration file:
38
+ pnpm build
39
+ ```
35
40
 
36
- ```bash
37
- mbler init
41
+ ## CLI Commands
42
+
43
+ | Command | Alias | Description |
44
+ | ---------------------------------------- | ----- | ----------------------------------------------------------- |
45
+ | `help [command]` | `h` | Show help for a command |
46
+ | `init [args...]` | | Initialize a project config file |
47
+ | `build` | | Build the addon (behavior + resources) |
48
+ | `watch` | | Watch mode with incremental rebuild |
49
+ | `work [path]` | `c` | Set or display the working directory |
50
+ | `set-work-dir <on\|off>` | | Enable/disable persistent working directory |
51
+ | `version [version]` | | Show or set version; `-show commit\|version` |
52
+ | `lang [zh\|en]` | | Switch CLI language |
53
+ | `config <get\|set\|point> [key] [value]` | | Global configuration |
54
+ | `publish` | | Publish to PMNX marketplace (`-tag`, `-build skip\|enable`) |
55
+ | `unpublish <package>` | | Remove a package from PMNX |
56
+ | `install <package>` | | Install a PMNX package |
57
+ | `uninstall <package>` | | Remove a PMNX package |
58
+ | `login [token]` | | Authenticate with PMNX marketplace |
59
+ | `profile` | | View current user profile |
60
+ | `view <package>` | | View package details |
61
+ | `log <point\|clean>` | | Log management |
62
+
63
+ ## Configuration
64
+
65
+ Create a `mbler.config.js` in your project root:
66
+
67
+ ```js
68
+ // @ts-check
69
+ import { defineConfig } from 'mbler'
70
+ export default defineConfig({
71
+ name: 'my-addon',
72
+ description: 'A custom Minecraft addon',
73
+ version: '0.0.1',
74
+ mcVersion: '1.21.120',
75
+ script: {
76
+ main: 'index.ts',
77
+ lang: 'mcx', // 'ts' | 'mcx' | 'js'
78
+ ui: true, // enable @minecraft/server-ui
79
+ },
80
+ minify: false, // 'oxc' | 'terser' | 'esbuild'
81
+ outdir: {
82
+ behavior: './dist/dep',
83
+ resources: './dist/res',
84
+ dist: './dist.mcaddon',
85
+ },
86
+ })
38
87
  ```
39
88
 
40
- For details, see: [Documentation](https://mbler-docs.ruanhor.dpdns.org/)
89
+ ## Project Structure
90
+
91
+ ```
92
+ mbler/
93
+ ├── bin/ # CLI entry points
94
+ │ ├── mbler.js # Main CLI binary
95
+ │ └── mcx-tsc.js # MCX type-checker
96
+ ├── src/
97
+ │ ├── cli/ # Command definitions & dispatcher
98
+ │ ├── build/ # Build engine (Rolldown-based)
99
+ │ │ ├── manifest.ts # manifest.json generator
100
+ │ │ ├── release.ts # .mcaddon packaging
101
+ │ │ ├── cache.ts # Incremental build cache
102
+ │ │ ├── minify.ts # Minifier plugins
103
+ │ │ └── sapi.ts # SAPI version resolver
104
+ │ ├── publisher/ # PMNX marketplace integration
105
+ │ ├── i18n/ # Internationalization (zh, en)
106
+ │ ├── uuid/ # Deterministic UUID generation
107
+ │ └── utils/ # Shared utilities
108
+ ├── example/mbler-int/ # Example addon project
109
+ ├── tests/ # Test suite (Vitest)
110
+ ├── dist/ # Build output
111
+ └── package.json
112
+ ```
41
113
 
42
- ### Release Platforms
114
+ ## Related Repos
43
115
 
44
- [github](https://github.com/RuanhoR/mbler) | [gitee](https://gitee.com/n304sc-haoran/mbler.git) | [npm](https://npmjs.com/package/mbler)
116
+ [MCX Core](https://github.com/RuanhoR/mcx-core) · [MCX Language Server](https://github.com/RuanhoR/mcx-language-server) · [MCX Template](https://github.com/RuanhoR/mcx-template) · [MNX Market](https://github.com/RuanhoR/mnx)
45
117
 
46
118
  ## Documentation
47
119
 
48
- [中文](https://zh-mbler-docs.ruanhor.dpdns.org/) | [English](https://mbler-docs.ruanhor.dpdns.org/) | [한국어](./README_ko.md) | [日本語](./README_ja.md)
120
+ - [English Docs](https://mbler-docs.ruanhor.dpdns.org/)
121
+ - [中文文档](https://zh-mbler-docs.ruanhor.dpdns.org/)
122
+ - [한국어](./README_ko.md)
123
+ - [日本語](./README_ja.md)
124
+
125
+ ## Release Platforms
126
+
127
+ [GitHub](https://github.com/RuanhoR/mbler) · [Gitee](https://gitee.com/n304sc-haoran/mbler.git) · [npm](https://npmjs.com/package/mbler)
128
+
129
+ ## License
130
+
131
+ [MIT](LICENSE)
package/dist/build.d.ts CHANGED
@@ -33,7 +33,7 @@ interface MblerConfigData {
33
33
  outdir?: MblerConfigOutdir;
34
34
  description: string;
35
35
  version: string;
36
- mcVersion: string | string[];
36
+ mcVersion: string;
37
37
  script?: MblerConfigScript;
38
38
  minify?: 'oxc' | 'terser' | 'esbuild';
39
39
  build?: Partial<MblerBuildConfig>;
@@ -96,6 +96,7 @@ declare class Build {
96
96
  * can call this method to clean up resources.
97
97
  */
98
98
  closeWatchers(): void;
99
+ private isDebug;
99
100
  private rollupPlugin;
100
101
  private cacheManager;
101
102
  init: boolean;