@cocos/ccbuild 2.3.17 → 2.3.18

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +16 -16
  3. package/modules/build-engine/lib/engine-js/babel-plugins/decorator-parser.js +10 -10
  4. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/core/enum.d.ts +12 -12
  5. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/core/enum.js +12 -12
  6. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/core/options.d.ts +17 -17
  7. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/core/options.js +4 -4
  8. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/index.d.ts +2 -2
  9. package/modules/build-engine/lib/engine-js/rollup-plugins/enum-scanner/index.js +2 -2
  10. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts +28 -28
  11. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js +10 -10
  12. package/modules/build-engine/lib/engine-js/ts-plugins/properties-minifier/index.d.ts +2 -2
  13. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts +2 -2
  14. package/modules/build-engine/lib/engine-ts/plugins/interface.d.ts +14 -14
  15. package/modules/build-engine/lib/index.d.ts +131 -131
  16. package/modules/build-engine/lib/index.js +16 -16
  17. package/modules/dts-bundler/lib/index.js +5 -5
  18. package/modules/modularize/lib/module-config.d.ts +70 -70
  19. package/modules/modularize/lib/module-query.d.ts +31 -31
  20. package/modules/modularize/lib/module-query.js +19 -19
  21. package/modules/stats-query/lib/config-interface.d.ts +68 -68
  22. package/modules/stats-query/lib/index.d.ts +63 -59
  23. package/modules/stats-query/lib/index.d.ts.map +1 -1
  24. package/modules/stats-query/lib/index.js +43 -43
  25. package/modules/stats-query/lib/index.js.map +1 -1
  26. package/package.json +1 -1
  27. package/static/helper-dynamic-constants.txt +13 -13
  28. package/static/helper-file-decorator.ts +20 -20
  29. package/static/helper-global-exporter.txt +8 -8
  30. package/static/lib.dom.d.ts +2330 -2330
@@ -1,16 +1,16 @@
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 IManglePropertiesOptions {
12
- /**
13
- * Prefix of generated names (default: '_ccprivate$')
12
+ /**
13
+ * Prefix of generated names (default: '_ccprivate$')
14
14
  */
15
15
  prefix?: string;
16
16
  mangleList?: string[];
@@ -20,179 +20,179 @@ export declare namespace buildEngine {
20
20
  ignoreJsDocTag?: boolean;
21
21
  }
22
22
  interface IWarningConfig {
23
- /**
24
- * 当没有显式声明构造函数时,是否要输出警告?
23
+ /**
24
+ * 当没有显式声明构造函数时,是否要输出警告?
25
25
  */
26
26
  noConstructorFound?: boolean;
27
- /**
28
- * 当函数内 'this.' 数量超过此阈值时,是否要输出警告?
27
+ /**
28
+ * 当函数内 'this.' 数量超过此阈值时,是否要输出警告?
29
29
  */
30
30
  thisDotThreshold?: number;
31
31
  }
32
32
  interface Options {
33
- /**
34
- * 引擎仓库目录。
33
+ /**
34
+ * 引擎仓库目录。
35
35
  */
36
36
  engine: string;
37
- /**
38
- * 输出目录。
37
+ /**
38
+ * 输出目录。
39
39
  */
40
40
  out: string;
41
41
  mode: StatsQuery.ConstantManager.ModeType;
42
42
  platform: StatsQuery.ConstantManager.PlatformType;
43
43
  flags?: Partial<StatsQuery.ConstantManager.IFlagConfig>;
44
- /**
45
- * 包含的功能。
44
+ /**
45
+ * 包含的功能。
46
46
  */
47
47
  features?: string[];
48
- /**
49
- * 输出模块格式。
50
- * @default 'system'
48
+ /**
49
+ * 输出模块格式。
50
+ * @default 'system'
51
51
  */
52
52
  moduleFormat?: ModuleFormat;
53
- /**
54
- * 是否对生成的脚本进行压缩。
55
- * @default false
53
+ /**
54
+ * 是否对生成的脚本进行压缩。
55
+ * @default false
56
56
  */
57
57
  compress?: boolean;
58
- /**
59
- * 是否内联枚举。支持 typescript const enum 和 enum。
60
- * @example
61
- * ```ts
62
- * enum MyEnum {
63
- * AAA,
64
- * BBB,
65
- * }
66
- *
67
- * const a = MyEnum.AAA;
68
- * const b = MyEnum.BBB;
69
- * ```
70
- * 将被优化为:
71
- * ```ts
72
- * var MyEnum = {
73
- * AAA: 0,
74
- * BBB: 1,
75
- * }
76
- *
77
- * const a = 0;
78
- * const b = 1;
79
- * ```
80
- *
81
- * @note 此功能要求项目中不能有同名的 enum,如果需要同名,可以定义枚举的时候用不同名字,然后在导出的时候 export as 跟其它模块同名的 enum。
58
+ /**
59
+ * 是否内联枚举。支持 typescript const enum 和 enum。
60
+ * @example
61
+ * ```ts
62
+ * enum MyEnum {
63
+ * AAA,
64
+ * BBB,
65
+ * }
66
+ *
67
+ * const a = MyEnum.AAA;
68
+ * const b = MyEnum.BBB;
69
+ * ```
70
+ * 将被优化为:
71
+ * ```ts
72
+ * var MyEnum = {
73
+ * AAA: 0,
74
+ * BBB: 1,
75
+ * }
76
+ *
77
+ * const a = 0;
78
+ * const b = 1;
79
+ * ```
80
+ *
81
+ * @note 此功能要求项目中不能有同名的 enum,如果需要同名,可以定义枚举的时候用不同名字,然后在导出的时候 export as 跟其它模块同名的 enum。
82
82
  */
83
83
  inlineEnum?: boolean;
84
- /**
85
- * 是否需要压缩私有属性。
86
- * @default true
84
+ /**
85
+ * 是否需要压缩私有属性。
86
+ * @default true
87
87
  */
88
88
  mangleProperties?: boolean | IManglePropertiesOptions;
89
- /**
90
- * 警告相关配置。
89
+ /**
90
+ * 警告相关配置。
91
91
  */
92
92
  warn?: IWarningConfig;
93
- /**
94
- * 是否生成 source map。
95
- * 若为 `inline` 则生成内联的 source map。
96
- * @default false
93
+ /**
94
+ * 是否生成 source map。
95
+ * 若为 `inline` 则生成内联的 source map。
96
+ * @default false
97
97
  */
98
98
  sourceMap?: boolean | 'inline';
99
- /**
100
- * 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
101
- * @default `${outputPath.map}`
99
+ /**
100
+ * 若 `sourceMap` 为 `true`,此选项指定了 source map 的路径。
101
+ * @default `${outputPath.map}`
102
102
  */
103
103
  sourceMapFile?: string;
104
- /**
105
- * 若为 `true`,分割出 **所有** 引擎子模块。
106
- * 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
107
- * @default false
104
+ /**
105
+ * 若为 `true`,分割出 **所有** 引擎子模块。
106
+ * 否则,`.moduleEntries` 指定的所有子模块将被合并成一个单独的 `"cc"` 模块。
107
+ * @default false
108
108
  */
109
109
  split?: boolean;
110
- /**
111
- * 原生代码的打包模式
112
- * - 为 `wasm` 时使用 wasm 版本原生库
113
- * - 为 `asmjs` 时使用 asmjs 版本的原生库
114
- * - 为 `both` 时同时在结果中包含 wasm 与 asmjs 两个版本的原生库
110
+ /**
111
+ * 原生代码的打包模式
112
+ * - 为 `wasm` 时使用 wasm 版本原生库
113
+ * - 为 `asmjs` 时使用 asmjs 版本的原生库
114
+ * - 为 `both` 时同时在结果中包含 wasm 与 asmjs 两个版本的原生库
115
115
  */
116
116
  nativeCodeBundleMode?: 'wasm' | 'asmjs' | 'both';
117
- /**
118
- * Wasm compression mode, 'brotli' means to compress .wasm to .wasm.br.
119
- * @note Currently, only WeChat and ByteDance mini-game support to load '.wasm.br' file.
117
+ /**
118
+ * Wasm compression mode, 'brotli' means to compress .wasm to .wasm.br.
119
+ * @note Currently, only WeChat and ByteDance mini-game support to load '.wasm.br' file.
120
120
  */
121
121
  wasmCompressionMode?: 'brotli';
122
- /**
123
- * If true, all deprecated features/API are excluded.
124
- * You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
125
- * @default false
122
+ /**
123
+ * If true, all deprecated features/API are excluded.
124
+ * You can also specify a version range(in semver range) to exclude deprecations in specified version(s).
125
+ * @default false
126
126
  */
127
127
  noDeprecatedFeatures?: string | boolean;
128
- /**
129
- * Experimental.
128
+ /**
129
+ * Experimental.
130
130
  */
131
131
  incremental?: string;
132
- /**
133
- * BrowsersList targets.
132
+ /**
133
+ * BrowsersList targets.
134
134
  */
135
135
  targets?: string | string[] | Record<string, string>;
136
- /**
137
- * Enable loose compilation.
138
- *
139
- * @deprecated since 1.1.20, we force using true internal.
136
+ /**
137
+ * Enable loose compilation.
138
+ *
139
+ * @deprecated since 1.1.20, we force using true internal.
140
140
  */
141
141
  loose?: boolean;
142
- /**
143
- * How to generate the reference to external assets:
144
- * - `'relative-from-out'`
145
- * Generate the path relative from `out` directory, does not contain the leading './'.
146
- *
147
- * - `'relative-from-chunk'`
148
- * Generate the path relative from the referencing output chunk.
149
- *
150
- * - `'dynamic'`(default)
151
- * Use runtime `URL` API to resolve the absolute URL.
152
- * This requires `URL` and `import.meta.url` to be valid.
142
+ /**
143
+ * How to generate the reference to external assets:
144
+ * - `'relative-from-out'`
145
+ * Generate the path relative from `out` directory, does not contain the leading './'.
146
+ *
147
+ * - `'relative-from-chunk'`
148
+ * Generate the path relative from the referencing output chunk.
149
+ *
150
+ * - `'dynamic'`(default)
151
+ * Use runtime `URL` API to resolve the absolute URL.
152
+ * This requires `URL` and `import.meta.url` to be valid.
153
153
  */
154
154
  assetURLFormat?: 'relative-from-out' | 'relative-from-chunk' | 'runtime-resolved';
155
- /**
156
- * Preserve engine type info, this options will build a TS engine to the output directory.
157
- * It's useful when we need to take a step towards the AOT optimization.
158
- * This options is only supported on Open Harmony platform for now.
159
- * @default false
155
+ /**
156
+ * Preserve engine type info, this options will build a TS engine to the output directory.
157
+ * It's useful when we need to take a step towards the AOT optimization.
158
+ * This options is only supported on Open Harmony platform for now.
159
+ * @default false
160
160
  */
161
161
  preserveType?: boolean;
162
162
  visualize?: boolean | {
163
163
  file?: string;
164
164
  };
165
- /**
166
- * Generate cocos/native-binding/decorators.ts for native platforms
165
+ /**
166
+ * Generate cocos/native-binding/decorators.ts for native platforms
167
167
  */
168
168
  generateDecoratorsForJSB?: boolean;
169
- /**
170
- * Whether to generate 'named' register code for systemjs module format.
171
- * SystemJS default register code: System.register([], function(){...});
172
- * SystemJS named register code: System.register('module_name', [], function(){...});
173
- * @note It's only avaiable when options.moduleFormat is 'system'.
169
+ /**
170
+ * Whether to generate 'named' register code for systemjs module format.
171
+ * SystemJS default register code: System.register([], function(){...});
172
+ * SystemJS named register code: System.register('module_name', [], function(){...});
173
+ * @note It's only avaiable when options.moduleFormat is 'system'.
174
174
  */
175
175
  enableNamedRegisterForSystemJSModuleFormat?: boolean;
176
176
  }
177
177
  interface Result {
178
- /**
179
- * Mappings between feature unit name and their actual chunk file, for example:
180
- * ```js
181
- * {
182
- * "core": "./core.js",
183
- * "gfx-webgl": "./gfx-webgl.js",
184
- * }
185
- * ```
178
+ /**
179
+ * Mappings between feature unit name and their actual chunk file, for example:
180
+ * ```js
181
+ * {
182
+ * "core": "./core.js",
183
+ * "gfx-webgl": "./gfx-webgl.js",
184
+ * }
185
+ * ```
186
186
  */
187
187
  exports: Record<string, string>;
188
- /**
189
- * The compulsory import mappings that should be applied.
188
+ /**
189
+ * The compulsory import mappings that should be applied.
190
190
  */
191
191
  chunkAliases: Record<string, string>;
192
- /**
193
- * The dependency graph, only including dependency chunks.
194
- *
195
- * @deprecated please use `chunkDepGraph` instead.
192
+ /**
193
+ * The dependency graph, only including dependency chunks.
194
+ *
195
+ * @deprecated please use `chunkDepGraph` instead.
196
196
  */
197
197
  dependencyGraph?: Record<string, string[]>;
198
198
  chunkDepGraph: Record<string, string[]>;
@@ -203,22 +203,22 @@ export declare namespace buildEngine {
203
203
  code: string;
204
204
  }>;
205
205
  function isSourceChanged(incrementalFile: string): Promise<boolean>;
206
- /**
207
- * Enumerates all chunk files that used by specified feature units.
208
- * @param meta Metadata of build result.
209
- * @param featureUnits Feature units.
206
+ /**
207
+ * Enumerates all chunk files that used by specified feature units.
208
+ * @param meta Metadata of build result.
209
+ * @param featureUnits Feature units.
210
210
  */
211
211
  function enumerateDependentChunks(meta: buildEngine.Result, featureUnits: string[]): string[];
212
- /**
213
- * Enumerates all asset files that used by specified feature units.
214
- * @param meta Metadata of build result.
215
- * @param featureUnits Feature units.
212
+ /**
213
+ * Enumerates all asset files that used by specified feature units.
214
+ * @param meta Metadata of build result.
215
+ * @param featureUnits Feature units.
216
216
  */
217
217
  function enumerateDependentAssets(meta: buildEngine.Result, featureUnits: string[]): string[];
218
- /**
219
- * Enumerates all chunk files and asset files that used by specified feature units.
220
- * @param meta Metadata of build result.
221
- * @param featureUnits Feature units.
218
+ /**
219
+ * Enumerates all chunk files and asset files that used by specified feature units.
220
+ * @param meta Metadata of build result.
221
+ * @param featureUnits Feature units.
222
222
  */
223
223
  function enumerateAllDependents(meta: buildEngine.Result, featureUnits: string[]): string[];
224
224
  }
@@ -50,8 +50,8 @@ function moduleOptionsToBabelEnvModules(moduleOptions) {
50
50
  throw new Error(`Unknown module format ${moduleOptions}`);
51
51
  }
52
52
  }
53
- /**
54
- * @group Merged Types
53
+ /**
54
+ * @group Merged Types
55
55
  */
56
56
  async function buildEngine(options) {
57
57
  applyDefaultOptions(options);
@@ -73,8 +73,8 @@ async function buildEngine(options) {
73
73
  }
74
74
  }
75
75
  exports.buildEngine = buildEngine;
76
- /**
77
- * @group Merged Types
76
+ /**
77
+ * @group Merged Types
78
78
  */
79
79
  (function (buildEngine) {
80
80
  async function transform(code, moduleOption, loose) {
@@ -158,29 +158,29 @@ exports.buildEngine = buildEngine;
158
158
  }
159
159
  return result;
160
160
  }
161
- /**
162
- * Enumerates all chunk files that used by specified feature units.
163
- * @param meta Metadata of build result.
164
- * @param featureUnits Feature units.
161
+ /**
162
+ * Enumerates all chunk files that used by specified feature units.
163
+ * @param meta Metadata of build result.
164
+ * @param featureUnits Feature units.
165
165
  */
166
166
  function enumerateDependentChunks(meta, featureUnits) {
167
167
  return _enumerateDependentChunks(meta, featureUnits);
168
168
  }
169
169
  buildEngine.enumerateDependentChunks = enumerateDependentChunks;
170
- /**
171
- * Enumerates all asset files that used by specified feature units.
172
- * @param meta Metadata of build result.
173
- * @param featureUnits Feature units.
170
+ /**
171
+ * Enumerates all asset files that used by specified feature units.
172
+ * @param meta Metadata of build result.
173
+ * @param featureUnits Feature units.
174
174
  */
175
175
  function enumerateDependentAssets(meta, featureUnits) {
176
176
  const dependentChunks = _enumerateDependentChunks(meta, featureUnits);
177
177
  return _enumerateDependentAssets(meta, dependentChunks);
178
178
  }
179
179
  buildEngine.enumerateDependentAssets = enumerateDependentAssets;
180
- /**
181
- * Enumerates all chunk files and asset files that used by specified feature units.
182
- * @param meta Metadata of build result.
183
- * @param featureUnits Feature units.
180
+ /**
181
+ * Enumerates all chunk files and asset files that used by specified feature units.
182
+ * @param meta Metadata of build result.
183
+ * @param featureUnits Feature units.
184
184
  */
185
185
  function enumerateAllDependents(meta, featureUnits) {
186
186
  const dependentChunks = _enumerateDependentChunks(meta, featureUnits);
@@ -315,11 +315,11 @@ exports.build = build;
315
315
  function buildIndexModule(featureUnits, statsQuery) {
316
316
  return `declare module "cc" {\n${statsQuery.evaluateIndexModuleSource(featureUnits).split('\n').map(line => ` ${line}`).join('\n')}\n}`;
317
317
  }
318
- /**
319
- * '@cocos/moduleName' -> 'cc/editor/moduleName'
320
- * '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
321
- * 'moduleName' -> 'cc/editor/moduleName'
322
- * @param moduleName
318
+ /**
319
+ * '@cocos/moduleName' -> 'cc/editor/moduleName'
320
+ * '@cocos/moduleName/editor' -> 'cc/editor/moduleName'
321
+ * 'moduleName' -> 'cc/editor/moduleName'
322
+ * @param moduleName
323
323
  */
324
324
  function transformToEditorModuleName(moduleName) {
325
325
  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' | 'NODEJS' | 'INVALID_PLATFORM';
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
46
  minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
47
47
  native?: AbstractPlatformExport<NativePlatformConfig>;
48
48
  web?: AbstractPlatformExport<WebPlatformConfig>;
49
49
  }>;
50
- /**
51
- * This is exported to the engine internal.
52
- * It useful when we need to export some friend interfaces for internal engine modules.
50
+ /**
51
+ * This is exported to the engine internal.
52
+ * It useful when we need to export some friend interfaces for internal engine modules.
53
53
  */
54
54
  './internal'?: ExportCondition<{
55
55
  minigame?: AbstractPlatformExport<MinigamePlatformConfig>;
56
56
  native?: AbstractPlatformExport<NativePlatformConfig>;
57
57
  web?: AbstractPlatformExport<WebPlatformConfig>;
58
58
  }>;
59
- /**
60
- * This is exported to the editor, which is useful when we need to export some editor only interfaces.
61
- * Also we build `cc.editor.d.ts` from this export condition's `types` field.
62
- * If this is not specified, we use the '.' export condition by default for module editor export,
63
- * otherwise, the build tools merges '.' and './editor' exports together for editor runtime environment.
64
- * It is different with `web_editor` or `native_editor` platform export:
65
- * - this condition exports some editor specific interfaces which is not cross-platform.
66
- * - 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.
59
+ /**
60
+ * This is exported to the editor, which is useful when we need to export some editor only interfaces.
61
+ * Also we build `cc.editor.d.ts` from this export condition's `types` field.
62
+ * If this is not specified, we use the '.' export condition by default for module editor export,
63
+ * otherwise, the build tools merges '.' and './editor' exports together for editor runtime environment.
64
+ * It is different with `web_editor` or `native_editor` platform export:
65
+ * - this condition exports some editor specific interfaces which is not cross-platform.
66
+ * - 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.
67
67
  */
68
68
  './editor'?: ExportCondition<{}>;
69
- /**
70
- * This export provide a the path of javascript module which exports some method to query the info of module.
69
+ /**
70
+ * This export provide a the path of javascript module which exports some method to query the info of module.
71
71
  */
72
72
  './query'?: string;
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
  };