mbler 0.2.7-rc.2 → 0.2.7-rc.3
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.d.ts +143 -143
- package/dist/build.esm.mjs +1450 -1748
- package/dist/build.esm.mjs.map +1 -1
- package/dist/build.js +1477 -1771
- package/dist/build.js.map +1 -1
- package/dist/index.d.ts +234 -236
- package/dist/index.esm.mjs +1730 -1975
- package/dist/index.esm.mjs.map +1 -1
- package/dist/index.js +1758 -1997
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/dist/template/js/behavior/pack_icon.png +0 -0
- package/dist/template/js/behavior/scripts/index.js +0 -1
- package/dist/template/js/resources/pack_icon.png +0 -0
- package/dist/template/mcx/behavior/scripts/app.mcx +0 -9
- package/dist/template/mcx/behavior/scripts/component/ComponentTest.mcx +0 -19
- package/dist/template/mcx/behavior/scripts/config/config.json +0 -5
- package/dist/template/mcx/behavior/scripts/event/event$1.mcx +0 -8
- package/dist/template/mcx/behavior/scripts/event/event.mcx +0 -10
- package/dist/template/mcx/behavior/scripts/event/test.ts +0 -3
- package/dist/template/mcx/behavior/scripts/index.ts +0 -5
- package/dist/template/mcx/resources/pack_icon.png +0 -0
- package/dist/template/mcx/resources/texts/en_US.lang +0 -2
- package/dist/template/mcx/resources/texts/zh_CN.lang +0 -2
- package/dist/template/ts/behavior/pack_icon.png +0 -0
- package/dist/template/ts/behavior/scripts/index.ts +0 -1
- package/dist/template/ts/resources/pack_icon.png +0 -0
package/dist/build.d.ts
CHANGED
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { LanguagePlugin } from '@volar/language-core';
|
|
1
|
+
import { watch as watch$1 } from "chokidar";
|
|
2
|
+
import { Plugin, RolldownWatcher } from "rolldown";
|
|
3
|
+
import { LanguagePlugin } from "@volar/language-core";
|
|
5
4
|
|
|
5
|
+
//#region src/types.d.ts
|
|
6
6
|
interface MblerConfigScript {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
ui?: boolean;
|
|
8
|
+
lang?: 'ts' | 'mcx' | 'js';
|
|
9
|
+
main: string;
|
|
10
|
+
UseBeta?: boolean;
|
|
11
11
|
}
|
|
12
12
|
interface MblerConfigOutdir {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
behavior?: string;
|
|
14
|
+
resources?: string;
|
|
15
|
+
dist: string;
|
|
16
16
|
}
|
|
17
17
|
interface MblerBuildConfig {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
rollupPlugins: Plugin[];
|
|
19
|
+
rollupExternal: string[];
|
|
20
|
+
cache: 'none' | 'memory' | 'file' | 'filesystem' | 'auto';
|
|
21
|
+
cachePath: string;
|
|
22
|
+
bundle: boolean;
|
|
23
|
+
clean?: boolean;
|
|
24
|
+
outputDir: string;
|
|
25
|
+
outputFilename: string;
|
|
26
|
+
onEnd: (ctx: MblerConfigData) => void | Promise<void>;
|
|
27
|
+
onStart: (ctx: MblerConfigData) => void | Promise<void>;
|
|
28
|
+
onWarn: (ctx: MblerConfigData, warning: Error) => void | Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
interface MblerConfigData {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
name: string;
|
|
32
|
+
outdir?: MblerConfigOutdir;
|
|
33
|
+
description: string;
|
|
34
|
+
version: string;
|
|
35
|
+
mcVersion: string | string[];
|
|
36
|
+
script?: MblerConfigScript;
|
|
37
|
+
minify?: boolean;
|
|
38
|
+
build?: Partial<MblerBuildConfig>;
|
|
38
39
|
}
|
|
39
40
|
interface CliParam {
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
params: string[];
|
|
42
|
+
opts: Record<string, string>;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/build/sapi.d.ts
|
|
44
46
|
/**
|
|
45
47
|
* Compare two dotted version strings ("major.minor.patch").
|
|
46
48
|
* Returns negative if a < b, positive if a > b, zero if equal.
|
|
47
49
|
*/
|
|
48
50
|
declare const Sapi: () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
refresh: () => Promise<void>;
|
|
52
|
+
generateVersion: (module: "@minecraft/server-ui" | "@minecraft/server", mcVersion: string, isBeta: boolean, withFull: boolean) => Promise<string>;
|
|
51
53
|
};
|
|
52
54
|
declare const _default: ReturnType<typeof Sapi>;
|
|
53
|
-
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/build/plugin-mcx-tsc.d.ts
|
|
54
57
|
/**
|
|
55
58
|
* 运行 MCX TypeScript 编译器
|
|
56
59
|
* 为 .mcx 文件提供 TypeScript 类型检查支持
|
|
57
60
|
*/
|
|
58
61
|
declare function runTSC(tscpath?: string): void;
|
|
59
|
-
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/build/index.d.ts
|
|
60
64
|
declare class Build {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* output directories and determine which modules exist in the project
|
|
163
|
-
* by inspecting the source directories.
|
|
164
|
-
*/
|
|
165
|
-
private handlerOtherAddon;
|
|
65
|
+
private baseBuildDir;
|
|
66
|
+
private resolve;
|
|
67
|
+
private isWatch;
|
|
68
|
+
currentConfig: MblerConfigData | null;
|
|
69
|
+
srcDirs: { [key in 'behavior' | 'resources']: string } | null;
|
|
70
|
+
outdirs: { [key in 'behavior' | 'resources' | 'dist']: string } | null;
|
|
71
|
+
mcxTs: typeof import('typescript');
|
|
72
|
+
mcxLanguagePluginCreator: ((ts: typeof import('typescript')) => LanguagePlugin<unknown>) | null;
|
|
73
|
+
constructor(opts: Record<string, string>, baseBuildDir: string, resolve: (a: number) => void, isWatch?: boolean);
|
|
74
|
+
/**
|
|
75
|
+
* Start the watch mode.
|
|
76
|
+
* This will perform an initial build (if not already done) and then
|
|
77
|
+
* start filesystem and rollup watchers.
|
|
78
|
+
* Returns the watcher handles once they are created so that callers
|
|
79
|
+
* (for example tests) can clean them up later.
|
|
80
|
+
*/
|
|
81
|
+
watch(): Promise<null | undefined>;
|
|
82
|
+
start(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Handles returned from the currently-active watchers.
|
|
85
|
+
* Set by {@link createWatcher} and exposed via {@link getWatchers}
|
|
86
|
+
* so that external callers can close them when necessary (e.g. tests).
|
|
87
|
+
*/
|
|
88
|
+
private watchers;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the watcher handles if watch mode has been started.
|
|
91
|
+
* Can be safely called even before `watch()` has been invoked.
|
|
92
|
+
*/
|
|
93
|
+
getWatchers(): {
|
|
94
|
+
rollup: RolldownWatcher | null;
|
|
95
|
+
chokidar: ReturnType<typeof watch$1>;
|
|
96
|
+
} | null;
|
|
97
|
+
/**
|
|
98
|
+
* Close any active watchers. The build process does not automatically
|
|
99
|
+
* terminate the watchers unless the process exits; tests or CLI wrappers
|
|
100
|
+
* can call this method to clean up resources.
|
|
101
|
+
*/
|
|
102
|
+
closeWatchers(): void;
|
|
103
|
+
private rollupPlugin;
|
|
104
|
+
private cacheManager;
|
|
105
|
+
init: boolean;
|
|
106
|
+
private buildConfig;
|
|
107
|
+
/**
|
|
108
|
+
* Which modules are present in the current project.
|
|
109
|
+
* - "behavior" when only behavior code exists
|
|
110
|
+
* - "resources" when only resource files exist
|
|
111
|
+
* - "all" when both are present
|
|
112
|
+
* This field is populated during `handlerOtherAddon`.
|
|
113
|
+
*/
|
|
114
|
+
module: 'behavior' | 'resources' | 'all' | null;
|
|
115
|
+
/**
|
|
116
|
+
* Determine whether a path refers to a regular file or a directory.
|
|
117
|
+
* Follows symbolic links recursively. Throws if the path exists but
|
|
118
|
+
* is not one of the expected types.
|
|
119
|
+
*
|
|
120
|
+
* @param filePath file system path to inspect
|
|
121
|
+
* @returns "file" or "directory"
|
|
122
|
+
*/
|
|
123
|
+
private fileType;
|
|
124
|
+
/**
|
|
125
|
+
* Perform a single build of the project located at {@link baseBuildDir}.
|
|
126
|
+
* The process is roughly:
|
|
127
|
+
* 1. load and validate the configuration file
|
|
128
|
+
* 2. prepare source and output directory information
|
|
129
|
+
* 3. copy addon files (behavior/resources)
|
|
130
|
+
* 4. generate manifest.json files
|
|
131
|
+
* 5. run rollup to bundle any script entry point
|
|
132
|
+
*
|
|
133
|
+
* If anything goes wrong the promise returned by the public wrapper
|
|
134
|
+
* (`build()` function exported at the bottom of this file) will be
|
|
135
|
+
* resolved with a non-zero code and appropriate log entries will be
|
|
136
|
+
* emitted.
|
|
137
|
+
*/
|
|
138
|
+
private build;
|
|
139
|
+
/**
|
|
140
|
+
* Create and return a Rollup build instance configured for the
|
|
141
|
+
* project's script. The Rollup configuration mirrors the options
|
|
142
|
+
* used by the CLI when running manual builds.
|
|
143
|
+
*
|
|
144
|
+
* Returns undefined if the project does not define a script section
|
|
145
|
+
* (in which case nothing needs to be bundled).
|
|
146
|
+
*/
|
|
147
|
+
private createRollup;
|
|
148
|
+
/**
|
|
149
|
+
* Internal helper invoked by {@link watch}.
|
|
150
|
+
* Ensures a build has been run before starting the watchers.
|
|
151
|
+
*/
|
|
152
|
+
private _watch;
|
|
153
|
+
private isParent;
|
|
154
|
+
private isChange;
|
|
155
|
+
private createRollupWatcher;
|
|
156
|
+
private onChange;
|
|
157
|
+
private createWatcher;
|
|
158
|
+
private handlerManifest;
|
|
159
|
+
private loadData;
|
|
160
|
+
/**
|
|
161
|
+
* Copy the various files (behavior/resources) into the corresponding
|
|
162
|
+
* output directories and determine which modules exist in the project
|
|
163
|
+
* by inspecting the source directories.
|
|
164
|
+
*/
|
|
165
|
+
private handlerOtherAddon;
|
|
166
166
|
}
|
|
167
167
|
declare function build(cliParam: CliParam, work: string): Promise<number>;
|
|
168
168
|
declare function watch(cliParam: CliParam, work: string): Promise<number>;
|
|
169
|
-
|
|
170
|
-
export { Build, runTSC as McxTsc, _default as Sapi, build, watch };
|
|
169
|
+
//#endregion
|
|
170
|
+
export { Build, runTSC as McxTsc, _default as Sapi, build, watch };
|