@cocos/ccbuild 2.0.3-alpha.11 → 2.0.3-alpha.12
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/CHANGELOG.md +6 -0
- package/README.md +16 -16
- package/modules/build-engine/lib/engine-js/index.d.ts.map +1 -1
- package/modules/build-engine/lib/engine-js/index.js +1 -0
- package/modules/build-engine/lib/engine-js/index.js.map +1 -1
- package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts +37 -33
- package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts.map +1 -1
- package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js +17 -14
- package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js.map +1 -1
- package/modules/build-engine/lib/engine-ts/engine-builder.d.ts.map +1 -1
- package/modules/build-engine/lib/engine-ts/engine-builder.js +3 -1
- package/modules/build-engine/lib/engine-ts/engine-builder.js.map +1 -1
- package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts +4 -0
- package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts.map +1 -1
- package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js +6 -3
- package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.js.map +1 -1
- package/modules/build-engine/lib/engine-ts/plugins/interface.d.ts +14 -14
- package/modules/build-engine/lib/index.d.ts +94 -94
- package/modules/build-engine/lib/index.js +16 -16
- package/modules/dts-bundler/lib/index.js +5 -5
- package/modules/modularize/lib/module-config.d.ts +70 -70
- package/modules/modularize/lib/module-query.d.ts +25 -25
- package/modules/modularize/lib/module-query.js +13 -13
- package/modules/modularize/lib/platform-config.d.ts +8 -8
- package/modules/modularize/lib/platform-config.js +8 -8
- package/modules/stats-query/lib/config-interface.d.ts +61 -61
- package/modules/stats-query/lib/index.d.ts +63 -57
- package/modules/stats-query/lib/index.d.ts.map +1 -1
- package/modules/stats-query/lib/index.js +41 -41
- package/modules/stats-query/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/static/helper-dynamic-constants.txt +13 -13
- package/static/helper-file-decorator.ts +20 -20
- package/static/helper-global-exporter.txt +8 -8
- package/static/lib.dom.d.ts +2330 -2330
- package/modules/build-engine/lib/build-dts.d.ts +0 -7
- package/modules/build-engine/lib/build-dts.d.ts.map +0 -1
- package/modules/build-engine/lib/build-dts.js +0 -297
- package/modules/build-engine/lib/build-dts.js.map +0 -1
|
@@ -1,131 +1,131 @@
|
|
|
1
1
|
import { StatsQuery } from "../../stats-query/lib/index";
|
|
2
|
-
/**
|
|
3
|
-
* @group Merged Types
|
|
2
|
+
/**
|
|
3
|
+
* @group Merged Types
|
|
4
4
|
*/
|
|
5
5
|
export declare function buildEngine(options: buildEngine.Options): Promise<buildEngine.Result>;
|
|
6
|
-
/**
|
|
7
|
-
* @group Merged Types
|
|
6
|
+
/**
|
|
7
|
+
* @group Merged Types
|
|
8
8
|
*/
|
|
9
9
|
export declare namespace buildEngine {
|
|
10
10
|
type ModuleFormat = 'esm' | 'cjs' | 'system' | 'iife';
|
|
11
11
|
interface Options {
|
|
12
|
-
/**
|
|
13
|
-
* 引擎仓库目录。
|
|
12
|
+
/**
|
|
13
|
+
* 引擎仓库目录。
|
|
14
14
|
*/
|
|
15
15
|
engine: string;
|
|
16
|
-
/**
|
|
17
|
-
* 输出目录。
|
|
16
|
+
/**
|
|
17
|
+
* 输出目录。
|
|
18
18
|
*/
|
|
19
19
|
out: string;
|
|
20
20
|
mode: StatsQuery.ConstantManager.ModeType;
|
|
21
21
|
platform: StatsQuery.ConstantManager.PlatformType;
|
|
22
22
|
flags?: Partial<StatsQuery.ConstantManager.IFlagConfig>;
|
|
23
|
-
/**
|
|
24
|
-
* 包含的功能。
|
|
23
|
+
/**
|
|
24
|
+
* 包含的功能。
|
|
25
25
|
*/
|
|
26
26
|
features?: string[];
|
|
27
|
-
/**
|
|
28
|
-
* 输出模块格式。
|
|
29
|
-
* @default 'system'
|
|
27
|
+
/**
|
|
28
|
+
* 输出模块格式。
|
|
29
|
+
* @default 'system'
|
|
30
30
|
*/
|
|
31
31
|
moduleFormat?: ModuleFormat;
|
|
32
|
-
/**
|
|
33
|
-
* 是否对生成结果进行压缩。
|
|
34
|
-
* @default false
|
|
32
|
+
/**
|
|
33
|
+
* 是否对生成结果进行压缩。
|
|
34
|
+
* @default false
|
|
35
35
|
*/
|
|
36
36
|
compress?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* 是否生成 source map。
|
|
39
|
-
* 若为 `inline` 则生成内联的 source map。
|
|
40
|
-
* @default false
|
|
37
|
+
/**
|
|
38
|
+
* 是否生成 source map。
|
|
39
|
+
* 若为 `inline` 则生成内联的 source map。
|
|
40
|
+
* @default false
|
|
41
41
|
*/
|
|
42
42
|
sourceMap?: boolean | 'inline';
|
|
43
|
-
/**
|
|
44
|
-
* 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
|
|
45
|
-
* @default `${outputPath.map}`
|
|
43
|
+
/**
|
|
44
|
+
* 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
|
|
45
|
+
* @default `${outputPath.map}`
|
|
46
46
|
*/
|
|
47
47
|
sourceMapFile?: string;
|
|
48
|
-
/**
|
|
49
|
-
* 若为 `true`,分割出 **所有** 引擎子模块。
|
|
50
|
-
* 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
|
|
51
|
-
* @default false
|
|
48
|
+
/**
|
|
49
|
+
* 若为 `true`,分割出 **所有** 引擎子模块。
|
|
50
|
+
* 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
|
|
51
|
+
* @default false
|
|
52
52
|
*/
|
|
53
53
|
split?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* 使用的 ammo.js 版本,也即 `@cocos/ammo` 映射到的版本。
|
|
56
|
-
* - 为 `true` 时使用 WebAssembly 版本的 ammo.js;
|
|
57
|
-
* - 为 `false` 时使用 asm.js 版本的 ammo.js;
|
|
58
|
-
* - 为 `'fallback` 时同时在结果中包含两个版本的 ammo.js,并自动根据环境 fallback 选择。
|
|
59
|
-
*
|
|
60
|
-
* 注意,`'fallback'` 只有在 SystemJS 和 Async functions 同时支持时才有效。
|
|
61
|
-
* @default true
|
|
62
|
-
*
|
|
63
|
-
* @deprecated 从 1.1.5 版本开始,该选项只会影响 FORCE_BANNING_BULLET_WASM 宏的值
|
|
64
|
-
* - 为 `true` 时,FORCE_BANNING_BULLET_WASM 为 false
|
|
65
|
-
* - 为 `false` 时,FORCE_BANNING_BULLET_WASM 为 true
|
|
66
|
-
* - 为 `'fallback'` 时, FORCE_BANNING_BULLET_WASM 为 false
|
|
54
|
+
/**
|
|
55
|
+
* 使用的 ammo.js 版本,也即 `@cocos/ammo` 映射到的版本。
|
|
56
|
+
* - 为 `true` 时使用 WebAssembly 版本的 ammo.js;
|
|
57
|
+
* - 为 `false` 时使用 asm.js 版本的 ammo.js;
|
|
58
|
+
* - 为 `'fallback` 时同时在结果中包含两个版本的 ammo.js,并自动根据环境 fallback 选择。
|
|
59
|
+
*
|
|
60
|
+
* 注意,`'fallback'` 只有在 SystemJS 和 Async functions 同时支持时才有效。
|
|
61
|
+
* @default true
|
|
62
|
+
*
|
|
63
|
+
* @deprecated 从 1.1.5 版本开始,该选项只会影响 FORCE_BANNING_BULLET_WASM 宏的值
|
|
64
|
+
* - 为 `true` 时,FORCE_BANNING_BULLET_WASM 为 false
|
|
65
|
+
* - 为 `false` 时,FORCE_BANNING_BULLET_WASM 为 true
|
|
66
|
+
* - 为 `'fallback'` 时, FORCE_BANNING_BULLET_WASM 为 false
|
|
67
67
|
*/
|
|
68
68
|
ammoJsWasm?: boolean | 'fallback';
|
|
69
|
-
/**
|
|
70
|
-
* If true, all deprecated features/API are excluded.
|
|
71
|
-
* You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
|
|
72
|
-
* @default false
|
|
69
|
+
/**
|
|
70
|
+
* If true, all deprecated features/API are excluded.
|
|
71
|
+
* You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
|
|
72
|
+
* @default false
|
|
73
73
|
*/
|
|
74
74
|
noDeprecatedFeatures?: string | boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Experimental.
|
|
75
|
+
/**
|
|
76
|
+
* Experimental.
|
|
77
77
|
*/
|
|
78
78
|
incremental?: string;
|
|
79
|
-
/**
|
|
80
|
-
* BrowsersList targets.
|
|
79
|
+
/**
|
|
80
|
+
* BrowsersList targets.
|
|
81
81
|
*/
|
|
82
82
|
targets?: string | string[] | Record<string, string>;
|
|
83
|
-
/**
|
|
84
|
-
* Enable loose compilation.
|
|
85
|
-
*
|
|
86
|
-
* @deprecated since 1.1.20, we force using true internal.
|
|
83
|
+
/**
|
|
84
|
+
* Enable loose compilation.
|
|
85
|
+
*
|
|
86
|
+
* @deprecated since 1.1.20, we force using true internal.
|
|
87
87
|
*/
|
|
88
88
|
loose?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* How to generate the reference to external assets:
|
|
91
|
-
* - `'relative-from-out'`
|
|
92
|
-
* Generate the path relative from `out` directory, does not contain the leading './'.
|
|
93
|
-
*
|
|
94
|
-
* - `'relative-from-chunk'`
|
|
95
|
-
* Generate the path relative from the referencing output chunk.
|
|
96
|
-
*
|
|
97
|
-
* - `'dynamic'`(default)
|
|
98
|
-
* Use runtime `URL` API to resolve the absolute URL.
|
|
99
|
-
* This requires `URL` and `import.meta.url` to be valid.
|
|
89
|
+
/**
|
|
90
|
+
* How to generate the reference to external assets:
|
|
91
|
+
* - `'relative-from-out'`
|
|
92
|
+
* Generate the path relative from `out` directory, does not contain the leading './'.
|
|
93
|
+
*
|
|
94
|
+
* - `'relative-from-chunk'`
|
|
95
|
+
* Generate the path relative from the referencing output chunk.
|
|
96
|
+
*
|
|
97
|
+
* - `'dynamic'`(default)
|
|
98
|
+
* Use runtime `URL` API to resolve the absolute URL.
|
|
99
|
+
* This requires `URL` and `import.meta.url` to be valid.
|
|
100
100
|
*/
|
|
101
101
|
assetURLFormat?: 'relative-from-out' | 'relative-from-chunk' | 'runtime-resolved';
|
|
102
|
-
/**
|
|
103
|
-
* Preserve engine type info, this options will build a TS engine to the output directory.
|
|
104
|
-
* It's useful when we need to take a step towards the AOT optimization.
|
|
105
|
-
* This options is only supported on Open Harmony platform for now.
|
|
106
|
-
* @default false
|
|
102
|
+
/**
|
|
103
|
+
* Preserve engine type info, this options will build a TS engine to the output directory.
|
|
104
|
+
* It's useful when we need to take a step towards the AOT optimization.
|
|
105
|
+
* This options is only supported on Open Harmony platform for now.
|
|
106
|
+
* @default false
|
|
107
107
|
*/
|
|
108
108
|
preserveType?: boolean;
|
|
109
109
|
}
|
|
110
110
|
interface Result {
|
|
111
|
-
/**
|
|
112
|
-
* Mappings between feature unit name and their actual chunk file, for example:
|
|
113
|
-
* ```js
|
|
114
|
-
* {
|
|
115
|
-
* "core": "./core.js",
|
|
116
|
-
* "gfx-webgl": "./gfx-webgl.js",
|
|
117
|
-
* }
|
|
118
|
-
* ```
|
|
111
|
+
/**
|
|
112
|
+
* Mappings between feature unit name and their actual chunk file, for example:
|
|
113
|
+
* ```js
|
|
114
|
+
* {
|
|
115
|
+
* "core": "./core.js",
|
|
116
|
+
* "gfx-webgl": "./gfx-webgl.js",
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
119
|
*/
|
|
120
120
|
exports: Record<string, string>;
|
|
121
|
-
/**
|
|
122
|
-
* The compulsory import mappings that should be applied.
|
|
121
|
+
/**
|
|
122
|
+
* The compulsory import mappings that should be applied.
|
|
123
123
|
*/
|
|
124
124
|
chunkAliases: Record<string, string>;
|
|
125
|
-
/**
|
|
126
|
-
* The dependency graph, only including dependency chunks.
|
|
127
|
-
*
|
|
128
|
-
* @deprecated please use `chunkDepGraph` instead.
|
|
125
|
+
/**
|
|
126
|
+
* The dependency graph, only including dependency chunks.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated please use `chunkDepGraph` instead.
|
|
129
129
|
*/
|
|
130
130
|
dependencyGraph?: Record<string, string[]>;
|
|
131
131
|
chunkDepGraph: Record<string, string[]>;
|
|
@@ -136,22 +136,22 @@ export declare namespace buildEngine {
|
|
|
136
136
|
code: string;
|
|
137
137
|
}>;
|
|
138
138
|
function isSourceChanged(incrementalFile: string): Promise<boolean>;
|
|
139
|
-
/**
|
|
140
|
-
* Enumerates all chunk files that used by specified feature units.
|
|
141
|
-
* @param meta Metadata of build result.
|
|
142
|
-
* @param featureUnits Feature units.
|
|
139
|
+
/**
|
|
140
|
+
* Enumerates all chunk files that used by specified feature units.
|
|
141
|
+
* @param meta Metadata of build result.
|
|
142
|
+
* @param featureUnits Feature units.
|
|
143
143
|
*/
|
|
144
144
|
function enumerateDependentChunks(meta: buildEngine.Result, featureUnits: string[]): string[];
|
|
145
|
-
/**
|
|
146
|
-
* Enumerates all asset files that used by specified feature units.
|
|
147
|
-
* @param meta Metadata of build result.
|
|
148
|
-
* @param featureUnits Feature units.
|
|
145
|
+
/**
|
|
146
|
+
* Enumerates all asset files that used by specified feature units.
|
|
147
|
+
* @param meta Metadata of build result.
|
|
148
|
+
* @param featureUnits Feature units.
|
|
149
149
|
*/
|
|
150
150
|
function enumerateDependentAssets(meta: buildEngine.Result, featureUnits: string[]): string[];
|
|
151
|
-
/**
|
|
152
|
-
* Enumerates all chunk files and asset files that used by specified feature units.
|
|
153
|
-
* @param meta Metadata of build result.
|
|
154
|
-
* @param featureUnits Feature units.
|
|
151
|
+
/**
|
|
152
|
+
* Enumerates all chunk files and asset files that used by specified feature units.
|
|
153
|
+
* @param meta Metadata of build result.
|
|
154
|
+
* @param featureUnits Feature units.
|
|
155
155
|
*/
|
|
156
156
|
function enumerateAllDependents(meta: buildEngine.Result, featureUnits: string[]): string[];
|
|
157
157
|
}
|
|
@@ -64,8 +64,8 @@ function moduleOptionsToBabelEnvModules(moduleOptions) {
|
|
|
64
64
|
throw new Error(`Unknown module format ${moduleOptions}`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
/**
|
|
68
|
-
* @group Merged Types
|
|
67
|
+
/**
|
|
68
|
+
* @group Merged Types
|
|
69
69
|
*/
|
|
70
70
|
function buildEngine(options) {
|
|
71
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,8 +89,8 @@ function buildEngine(options) {
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
exports.buildEngine = buildEngine;
|
|
92
|
-
/**
|
|
93
|
-
* @group Merged Types
|
|
92
|
+
/**
|
|
93
|
+
* @group Merged Types
|
|
94
94
|
*/
|
|
95
95
|
(function (buildEngine) {
|
|
96
96
|
function transform(code, moduleOption, loose) {
|
|
@@ -178,29 +178,29 @@ exports.buildEngine = buildEngine;
|
|
|
178
178
|
}
|
|
179
179
|
return result;
|
|
180
180
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Enumerates all chunk files that used by specified feature units.
|
|
183
|
-
* @param meta Metadata of build result.
|
|
184
|
-
* @param featureUnits Feature units.
|
|
181
|
+
/**
|
|
182
|
+
* Enumerates all chunk files that used by specified feature units.
|
|
183
|
+
* @param meta Metadata of build result.
|
|
184
|
+
* @param featureUnits Feature units.
|
|
185
185
|
*/
|
|
186
186
|
function enumerateDependentChunks(meta, featureUnits) {
|
|
187
187
|
return _enumerateDependentChunks(meta, featureUnits);
|
|
188
188
|
}
|
|
189
189
|
buildEngine.enumerateDependentChunks = enumerateDependentChunks;
|
|
190
|
-
/**
|
|
191
|
-
* Enumerates all asset files that used by specified feature units.
|
|
192
|
-
* @param meta Metadata of build result.
|
|
193
|
-
* @param featureUnits Feature units.
|
|
190
|
+
/**
|
|
191
|
+
* Enumerates all asset files that used by specified feature units.
|
|
192
|
+
* @param meta Metadata of build result.
|
|
193
|
+
* @param featureUnits Feature units.
|
|
194
194
|
*/
|
|
195
195
|
function enumerateDependentAssets(meta, featureUnits) {
|
|
196
196
|
const dependentChunks = _enumerateDependentChunks(meta, featureUnits);
|
|
197
197
|
return _enumerateDependentAssets(meta, dependentChunks);
|
|
198
198
|
}
|
|
199
199
|
buildEngine.enumerateDependentAssets = enumerateDependentAssets;
|
|
200
|
-
/**
|
|
201
|
-
* Enumerates all chunk files and asset files that used by specified feature units.
|
|
202
|
-
* @param meta Metadata of build result.
|
|
203
|
-
* @param featureUnits Feature units.
|
|
200
|
+
/**
|
|
201
|
+
* Enumerates all chunk files and asset files that used by specified feature units.
|
|
202
|
+
* @param meta Metadata of build result.
|
|
203
|
+
* @param featureUnits Feature units.
|
|
204
204
|
*/
|
|
205
205
|
function enumerateAllDependents(meta, featureUnits) {
|
|
206
206
|
const dependentChunks = _enumerateDependentChunks(meta, featureUnits);
|
|
@@ -331,11 +331,11 @@ exports.build = build;
|
|
|
331
331
|
function buildIndexModule(featureUnits, statsQuery) {
|
|
332
332
|
return `declare module "cc" {\n${statsQuery.evaluateIndexModuleSource(featureUnits).split('\n').map(line => ` ${line}`).join('\n')}\n}`;
|
|
333
333
|
}
|
|
334
|
-
/**
|
|
335
|
-
* '@cocos/moduleName' -> 'cc/editor/moduleName'
|
|
336
|
-
* '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
|
|
337
|
-
* 'moduleName' -> 'cc/editor/moduleName'
|
|
338
|
-
* @param moduleName
|
|
334
|
+
/**
|
|
335
|
+
* '@cocos/moduleName' -> 'cc/editor/moduleName'
|
|
336
|
+
* '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
|
|
337
|
+
* 'moduleName' -> 'cc/editor/moduleName'
|
|
338
|
+
* @param moduleName
|
|
339
339
|
*/
|
|
340
340
|
function transformToEditorModuleName(moduleName) {
|
|
341
341
|
const split = moduleName.split('/');
|
|
@@ -3,130 +3,130 @@ export type MinigamePlatformConfig = { [key in Lowercase<keyof typeof MinigamePl
|
|
|
3
3
|
export type NativePlatformConfig = { [key in Lowercase<keyof typeof NativePlatform>]?: string };
|
|
4
4
|
export type WebPlatformConfig = { [key in Lowercase<keyof typeof WebPlatform>]?: string };
|
|
5
5
|
export type PlatformType = Uppercase<keyof typeof WebPlatform | keyof typeof MinigamePlatform | keyof typeof NativePlatform> | 'HTML5' | 'NATIVE';
|
|
6
|
-
/**
|
|
7
|
-
* Abstract platform export, like `web`, `native` and `minigame`.
|
|
8
|
-
* Usually this is used for PAL modules.
|
|
9
|
-
* The build tools resolve the relative platform as entry according to the build platform config.
|
|
10
|
-
* - The value can be a `string` or a `object` which requires a default item.
|
|
11
|
-
* eg. { "web": "/path/to/index.ts" } is equals to { "web": { default: "/path/to/index.ts" } }.
|
|
12
|
-
* - We can also specify the exact platform like
|
|
13
|
-
* { "web": {default: "/path/to/index.ts", "web-desktop": "/path/to/index.ts" } }.
|
|
6
|
+
/**
|
|
7
|
+
* Abstract platform export, like `web`, `native` and `minigame`.
|
|
8
|
+
* Usually this is used for PAL modules.
|
|
9
|
+
* The build tools resolve the relative platform as entry according to the build platform config.
|
|
10
|
+
* - The value can be a `string` or a `object` which requires a default item.
|
|
11
|
+
* eg. { "web": "/path/to/index.ts" } is equals to { "web": { default: "/path/to/index.ts" } }.
|
|
12
|
+
* - We can also specify the exact platform like
|
|
13
|
+
* { "web": {default: "/path/to/index.ts", "web-desktop": "/path/to/index.ts" } }.
|
|
14
14
|
*/
|
|
15
15
|
type AbstractPlatformExport<T> = ({
|
|
16
|
-
/**
|
|
17
|
-
* Default platform export for unspecified platforms.
|
|
16
|
+
/**
|
|
17
|
+
* Default platform export for unspecified platforms.
|
|
18
18
|
*/
|
|
19
19
|
default: string;
|
|
20
20
|
} & T) | string;
|
|
21
|
-
/**
|
|
22
|
-
* The export condition. `types` fields are required.
|
|
21
|
+
/**
|
|
22
|
+
* The export condition. `types` fields are required.
|
|
23
23
|
*/
|
|
24
24
|
type ExportCondition<T> = {
|
|
25
|
-
/**
|
|
26
|
-
* This is the main module export condition.
|
|
27
|
-
* - The dts bundle tools resolve this condition as entry.
|
|
28
|
-
* - The API doc tools resolve this condition as entry.
|
|
29
|
-
* - If no platform export is specified, the build tools resolve this condition as entry.
|
|
25
|
+
/**
|
|
26
|
+
* This is the main module export condition.
|
|
27
|
+
* - The dts bundle tools resolve this condition as entry.
|
|
28
|
+
* - The API doc tools resolve this condition as entry.
|
|
29
|
+
* - If no platform export is specified, the build tools resolve this condition as entry.
|
|
30
30
|
*/
|
|
31
31
|
types: string;
|
|
32
|
-
/**
|
|
33
|
-
* The custom condition, for example:
|
|
34
|
-
* - For gfx module: {"webgl1": "/path/to/webgl1/index.ts", "webgl2": "/path/to/webgl2/index.ts"}
|
|
35
|
-
* - For physics module {"cannon": "/path/to/cannon/index.ts", "physX": "/path/to/physX/index.ts"}
|
|
32
|
+
/**
|
|
33
|
+
* The custom condition, for example:
|
|
34
|
+
* - For gfx module: {"webgl1": "/path/to/webgl1/index.ts", "webgl2": "/path/to/webgl2/index.ts"}
|
|
35
|
+
* - For physics module {"cannon": "/path/to/cannon/index.ts", "physX": "/path/to/physX/index.ts"}
|
|
36
36
|
*/
|
|
37
37
|
[customCondition: string]: string;
|
|
38
38
|
} & T;
|
|
39
39
|
interface ConditionalExports {
|
|
40
|
-
/**
|
|
41
|
-
* This is exported to the game runtime.
|
|
42
|
-
* Also we build the `cc.d.ts` with this export condition's `types` field.
|
|
43
|
-
* `node` field is required to resolve the path of package.json for build tools.
|
|
40
|
+
/**
|
|
41
|
+
* This is exported to the game runtime.
|
|
42
|
+
* Also we build the `cc.d.ts` with this export condition's `types` field.
|
|
43
|
+
* `node` field is required to resolve the path of package.json for build tools.
|
|
44
44
|
*/
|
|
45
45
|
'.': ExportCondition<{
|
|
46
|
-
/**
|
|
47
|
-
* `node` should be specified as './package.json' to resolve the path of package.json for build tools.
|
|
46
|
+
/**
|
|
47
|
+
* `node` should be specified as './package.json' to resolve the path of package.json for build tools.
|
|
48
48
|
*/
|
|
49
49
|
node: './package.json';
|
|
50
50
|
minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
|
|
51
51
|
native?: AbstractPlatformExport<NativePlatformConfig>;
|
|
52
52
|
web?: AbstractPlatformExport<WebPlatformConfig>;
|
|
53
53
|
}>;
|
|
54
|
-
/**
|
|
55
|
-
* This is exported to the engine internal.
|
|
56
|
-
* It useful when we need to export some friend interfaces for internal engine modules.
|
|
54
|
+
/**
|
|
55
|
+
* This is exported to the engine internal.
|
|
56
|
+
* It useful when we need to export some friend interfaces for internal engine modules.
|
|
57
57
|
*/
|
|
58
58
|
'./internal'?: ExportCondition<{
|
|
59
59
|
minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
|
|
60
60
|
native?: AbstractPlatformExport<NativePlatformConfig>;
|
|
61
61
|
web?: AbstractPlatformExport<WebPlatformConfig>;
|
|
62
62
|
}>;
|
|
63
|
-
/**
|
|
64
|
-
* This is exported to the editor, which is useful when we need to export some editor only interfaces.
|
|
65
|
-
* Also we build `cc.editor.d.ts` from this export condition's `types` field.
|
|
66
|
-
* If this is not specified, we use the '.' export condition by default for module editor export,
|
|
67
|
-
* otherwise, the build tools merges '.' and './editor' exports together for editor runtime environment.
|
|
68
|
-
* It is different with `web_editor` or `native_editor` platform export:
|
|
69
|
-
* - this condition exports some editor specific interfaces which is not cross-platform.
|
|
70
|
-
* - the `web_editor` or `native_editor` platform export is an editor version of implementation of interfaces defined in `types` field which should be cross-platform.
|
|
63
|
+
/**
|
|
64
|
+
* This is exported to the editor, which is useful when we need to export some editor only interfaces.
|
|
65
|
+
* Also we build `cc.editor.d.ts` from this export condition's `types` field.
|
|
66
|
+
* If this is not specified, we use the '.' export condition by default for module editor export,
|
|
67
|
+
* otherwise, the build tools merges '.' and './editor' exports together for editor runtime environment.
|
|
68
|
+
* It is different with `web_editor` or `native_editor` platform export:
|
|
69
|
+
* - this condition exports some editor specific interfaces which is not cross-platform.
|
|
70
|
+
* - the `web_editor` or `native_editor` platform export is an editor version of implementation of interfaces defined in `types` field which should be cross-platform.
|
|
71
71
|
*/
|
|
72
72
|
'./editor'?: ExportCondition<{}>;
|
|
73
73
|
}
|
|
74
74
|
interface ModuleOverride {
|
|
75
|
-
/**
|
|
76
|
-
* The test string to evaluate.
|
|
75
|
+
/**
|
|
76
|
+
* The test string to evaluate.
|
|
77
77
|
*/
|
|
78
78
|
test: string;
|
|
79
|
-
/**
|
|
80
|
-
* The override config, override mapping from key to value.
|
|
79
|
+
/**
|
|
80
|
+
* The override config, override mapping from key to value.
|
|
81
81
|
*/
|
|
82
82
|
overrides: Record<string, string>;
|
|
83
83
|
}
|
|
84
84
|
export interface ModuleConfig {
|
|
85
85
|
[key: string]: unknown;
|
|
86
|
-
/**
|
|
87
|
-
* The module name.
|
|
86
|
+
/**
|
|
87
|
+
* The module name.
|
|
88
88
|
*/
|
|
89
89
|
name: string;
|
|
90
|
-
/**
|
|
91
|
-
* The version of module.
|
|
92
|
-
* It is useful when we change the module config, then we need to make some migration.
|
|
93
|
-
* This usually comes with the `cc.migrations` field.
|
|
90
|
+
/**
|
|
91
|
+
* The version of module.
|
|
92
|
+
* It is useful when we change the module config, then we need to make some migration.
|
|
93
|
+
* This usually comes with the `cc.migrations` field.
|
|
94
94
|
*/
|
|
95
95
|
version: string;
|
|
96
|
-
/**
|
|
97
|
-
* The config for conditional exports.
|
|
96
|
+
/**
|
|
97
|
+
* The config for conditional exports.
|
|
98
98
|
*/
|
|
99
99
|
exports: ConditionalExports;
|
|
100
|
-
/**
|
|
101
|
-
* Specify the module dependencies is required if this module import another one.
|
|
102
|
-
* We need this field to generate the module dependency graph.
|
|
100
|
+
/**
|
|
101
|
+
* Specify the module dependencies is required if this module import another one.
|
|
102
|
+
* We need this field to generate the module dependency graph.
|
|
103
103
|
*/
|
|
104
104
|
dependencies?: Record<string, string>;
|
|
105
|
-
/**
|
|
106
|
-
* Specify the dev dependencies, these dependencies are always used in `scripts` folder.
|
|
105
|
+
/**
|
|
106
|
+
* Specify the dev dependencies, these dependencies are always used in `scripts` folder.
|
|
107
107
|
*/
|
|
108
108
|
devDependencies?: Record<string, string>;
|
|
109
|
-
/**
|
|
110
|
-
* The dependencies between modules form a tree-structured dependency graph.
|
|
111
|
-
* The correct dependency relationship should be that the upper module depends on the lower module one-way, and the reverse is wrong.
|
|
112
|
-
* However, it is normal for modules at the same layer to depend on each other, and such dependencies should be declared as `peerDependencies`.
|
|
113
|
-
* Otherwise the Turbo pipeline will report an error due to module circular dependencies.
|
|
114
|
-
* see: https://github.com/vercel/turbo/issues/1480
|
|
109
|
+
/**
|
|
110
|
+
* The dependencies between modules form a tree-structured dependency graph.
|
|
111
|
+
* The correct dependency relationship should be that the upper module depends on the lower module one-way, and the reverse is wrong.
|
|
112
|
+
* However, it is normal for modules at the same layer to depend on each other, and such dependencies should be declared as `peerDependencies`.
|
|
113
|
+
* Otherwise the Turbo pipeline will report an error due to module circular dependencies.
|
|
114
|
+
* see: https://github.com/vercel/turbo/issues/1480
|
|
115
115
|
*/
|
|
116
116
|
peerDependencies?: Record<string, string>;
|
|
117
|
-
/**
|
|
118
|
-
* This is a CC-specific item difference from the node package.json standard specification.
|
|
117
|
+
/**
|
|
118
|
+
* This is a CC-specific item difference from the node package.json standard specification.
|
|
119
119
|
*/
|
|
120
120
|
cc?: {
|
|
121
|
-
/**
|
|
122
|
-
* The module asset dependencies, which is an array of asset uuid.
|
|
121
|
+
/**
|
|
122
|
+
* The module asset dependencies, which is an array of asset uuid.
|
|
123
123
|
*/
|
|
124
124
|
assetDependencies?: string[];
|
|
125
|
-
/**
|
|
126
|
-
* This is different with conditional exports.
|
|
127
|
-
* Sometimes we just want to override a script file instead of the whole module.
|
|
128
|
-
* Module override could support to do this job.
|
|
129
|
-
* - eg. { "test": "context.mode === 'BUILD'", "overrides": { "/path/to/dev.ts": "/path/to/build.ts" } }
|
|
125
|
+
/**
|
|
126
|
+
* This is different with conditional exports.
|
|
127
|
+
* Sometimes we just want to override a script file instead of the whole module.
|
|
128
|
+
* Module override could support to do this job.
|
|
129
|
+
* - eg. { "test": "context.mode === 'BUILD'", "overrides": { "/path/to/dev.ts": "/path/to/build.ts" } }
|
|
130
130
|
*/
|
|
131
131
|
moduleOverrides?: ModuleOverride[];
|
|
132
132
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { ModuleConfig, PlatformType } from './module-config';
|
|
2
2
|
export interface ModuleQueryContext {
|
|
3
|
-
/**
|
|
4
|
-
* The engine root path.
|
|
3
|
+
/**
|
|
4
|
+
* The engine root path.
|
|
5
5
|
*/
|
|
6
6
|
engine: string;
|
|
7
|
-
/**
|
|
8
|
-
* The platform to resolve conditional export.
|
|
7
|
+
/**
|
|
8
|
+
* The platform to resolve conditional export.
|
|
9
9
|
*/
|
|
10
10
|
platform: PlatformType;
|
|
11
|
-
/**
|
|
12
|
-
* The custom export condition.
|
|
13
|
-
* The higher the array is sorted, the higher the priority is.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* [ 'webgl1', 'cannon' ] // the backend of 'gfx' and 'physics' modules.
|
|
18
|
-
* ```
|
|
11
|
+
/**
|
|
12
|
+
* The custom export condition.
|
|
13
|
+
* The higher the array is sorted, the higher the priority is.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* [ 'webgl1', 'cannon' ] // the backend of 'gfx' and 'physics' modules.
|
|
18
|
+
* ```
|
|
19
19
|
*/
|
|
20
20
|
customExportConditions?: string[];
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* The module info manager.
|
|
22
|
+
/**
|
|
23
|
+
* The module info manager.
|
|
24
24
|
*/
|
|
25
25
|
export declare class ModuleQuery {
|
|
26
26
|
private _context;
|
|
@@ -28,25 +28,25 @@ export declare class ModuleQuery {
|
|
|
28
28
|
private _resolvedCache;
|
|
29
29
|
private _cachedHasEditorSpecificExport;
|
|
30
30
|
constructor(context: ModuleQueryContext);
|
|
31
|
-
/**
|
|
32
|
-
* Get all modules' name defined in engine workspaces.
|
|
31
|
+
/**
|
|
32
|
+
* Get all modules' name defined in engine workspaces.
|
|
33
33
|
*/
|
|
34
34
|
getAllModules(): Promise<string[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Resolve module package.json path by module name.
|
|
35
|
+
/**
|
|
36
|
+
* Resolve module package.json path by module name.
|
|
37
37
|
*/
|
|
38
38
|
resolvePackageJson(moduleName: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Get module config by module name.
|
|
39
|
+
/**
|
|
40
|
+
* Get module config by module name.
|
|
41
41
|
*/
|
|
42
42
|
getConfig(moduleName: string): Promise<ModuleConfig>;
|
|
43
|
-
/**
|
|
44
|
-
* Resolve module entry path by import source.
|
|
43
|
+
/**
|
|
44
|
+
* Resolve module entry path by import source.
|
|
45
45
|
*/
|
|
46
46
|
resolveExport(source: string): Promise<string | void>;
|
|
47
|
-
/**
|
|
48
|
-
* To detect whether the module has a './editor' export.
|
|
49
|
-
* @param moduleName
|
|
47
|
+
/**
|
|
48
|
+
* To detect whether the module has a './editor' export.
|
|
49
|
+
* @param moduleName
|
|
50
50
|
*/
|
|
51
51
|
hasEditorSpecificExport(moduleName: string): Promise<boolean>;
|
|
52
52
|
private _isWebPlatform;
|