@cocos/ccbuild 2.3.17 → 2.3.19

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 (33) hide show
  1. package/CHANGELOG.md +412 -400
  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-config.schema.json +10 -10
  20. package/modules/modularize/lib/module-query.d.ts +31 -31
  21. package/modules/modularize/lib/module-query.js +19 -19
  22. package/modules/modularize/lib/platform-config.d.ts +2 -2
  23. package/modules/modularize/lib/platform-config.d.ts.map +1 -1
  24. package/modules/modularize/lib/platform-config.js +2 -2
  25. package/modules/modularize/lib/platform-config.js.map +1 -1
  26. package/modules/stats-query/lib/config-interface.d.ts +68 -68
  27. package/modules/stats-query/lib/index.d.ts +59 -59
  28. package/modules/stats-query/lib/index.js +43 -43
  29. package/package.json +1 -1
  30. package/static/helper-dynamic-constants.txt +13 -13
  31. package/static/helper-file-decorator.ts +20 -20
  32. package/static/helper-global-exporter.txt +8 -8
  33. package/static/lib.dom.d.ts +2330 -2330
@@ -2,83 +2,83 @@ import { Context, Test } from './config-interface';
2
2
  import * as ConfigInterface from './config-interface';
3
3
  import { PlatformType as _PlatformType } from "../../modularize/lib/index";
4
4
  export { ConfigInterface };
5
- /**
6
- * Query any any stats of the engine.
7
- * @group Merged Types
5
+ /**
6
+ * Query any any stats of the engine.
7
+ * @group Merged Types
8
8
  */
9
9
  export declare class StatsQuery {
10
- /**
11
- * @param engine Path to the engine root.
10
+ /**
11
+ * @param engine Path to the engine root.
12
12
  */
13
13
  static create(engine: string): Promise<StatsQuery>;
14
- /**
15
- * Constant manager for engine and user.
14
+ /**
15
+ * Constant manager for engine and user.
16
16
  */
17
17
  constantManager: StatsQuery.ConstantManager;
18
- /**
19
- * Gets the path to the engine root.
18
+ /**
19
+ * Gets the path to the engine root.
20
20
  */
21
21
  get path(): string;
22
- /**
23
- * Gets the path to tsconfig.
22
+ /**
23
+ * Gets the path to tsconfig.
24
24
  */
25
25
  get tsConfigPath(): string;
26
- /**
27
- * Gets all optimzie decorators
26
+ /**
27
+ * Gets all optimzie decorators
28
28
  */
29
29
  getOptimizeDecorators(): ConfigInterface.IOptimizeDecorators;
30
- /**
31
- * Gets TreeShake config
30
+ /**
31
+ * Gets TreeShake config
32
32
  */
33
33
  getTreeShakeConfig(): ConfigInterface.ITreeShakeConfig | undefined;
34
- /**
35
- * Gets all features defined.
34
+ /**
35
+ * Gets all features defined.
36
36
  */
37
37
  getFeatures(): string[];
38
- /**
39
- * Returns if the specified feature is defined.
40
- * @param feature Feature ID.
38
+ /**
39
+ * Returns if the specified feature is defined.
40
+ * @param feature Feature ID.
41
41
  */
42
42
  hasFeature(feature: string): boolean;
43
- /**
44
- * Gets all feature units included in specified features.
45
- * @param featureIds Feature ID.
43
+ /**
44
+ * Gets all feature units included in specified features.
45
+ * @param featureIds Feature ID.
46
46
  */
47
47
  getUnitsOfFeatures(featureIds: string[]): string[];
48
48
  getIntrinsicFlagsOfFeatures(featureIds: string[]): Record<string, number | boolean | string>;
49
49
  getOverriddenConstantsOfFeatures(featureIds: string[]): Record<string, number | boolean>;
50
- /**
51
- * Gets all feature units in their names.
50
+ /**
51
+ * Gets all feature units in their names.
52
52
  */
53
53
  getFeatureUnits(): string[];
54
- /**
55
- * Gets the path to source file of the feature unit.
56
- * @param moduleId Name of the feature unit.
54
+ /**
55
+ * Gets the path to source file of the feature unit.
56
+ * @param moduleId Name of the feature unit.
57
57
  */
58
58
  getFeatureUnitFile(featureUnit: string): string;
59
- /**
60
- * Gets all editor public modules in their names.
59
+ /**
60
+ * Gets all editor public modules in their names.
61
61
  */
62
62
  getEditorPublicModules(): string[];
63
- /**
64
- * Gets the path to source file of the editor-public module.
65
- * @param moduleName Name of the public module.
63
+ /**
64
+ * Gets the path to source file of the editor-public module.
65
+ * @param moduleName Name of the public module.
66
66
  */
67
67
  getEditorPublicModuleFile(moduleName: string): string;
68
- /**
69
- * Gets the source of `'cc'`.
70
- * @param featureUnits Involved feature units.
71
- * @param mapper If exists, map the feature unit name into another module request.
68
+ /**
69
+ * Gets the source of `'cc'`.
70
+ * @param featureUnits Involved feature units.
71
+ * @param mapper If exists, map the feature unit name into another module request.
72
72
  */
73
73
  evaluateIndexModuleSource(featureUnits: string[], mapper?: (featureUnit: string) => string): string;
74
- /**
75
- * Evaluates the source of `'internal-constants'`(`'cc/env'`),
76
- * @param context
74
+ /**
75
+ * Evaluates the source of `'internal-constants'`(`'cc/env'`),
76
+ * @param context
77
77
  */
78
78
  evaluateEnvModuleSourceFromRecord(record: Record<string, unknown>): string;
79
- /**
80
- * Evaluates module overrides under specified context.
81
- * @param context
79
+ /**
80
+ * Evaluates module overrides under specified context.
81
+ * @param context
82
82
  */
83
83
  evaluateModuleOverrides(context: Context): Record<string, string>;
84
84
  private static _readModulesInDir;
@@ -95,8 +95,8 @@ export declare class StatsQuery {
95
95
  private _featureUnits;
96
96
  private _editorPublicModules;
97
97
  }
98
- /**
99
- * @group Merged Types
98
+ /**
99
+ * @group Merged Types
100
100
  */
101
101
  export declare namespace StatsQuery {
102
102
  namespace ConstantManager {
@@ -106,28 +106,28 @@ export declare namespace StatsQuery {
106
106
  SERVER_MODE: boolean;
107
107
  NOT_PACK_PHYSX_LIBS: boolean;
108
108
  WEBGPU: boolean;
109
- /**
110
- * Native code (wasm/asmjs) bundle mode, 0: asmjs, 1: wasm, 2: both
111
- * @default 2
109
+ /**
110
+ * Native code (wasm/asmjs) bundle mode, 0: asmjs, 1: wasm, 2: both
111
+ * @default 2
112
112
  */
113
113
  NATIVE_CODE_BUNDLE_MODE: number;
114
- /**
115
- * An internal constant to indicate whether we cull the meshopt wasm module and asm.js module.
116
- *
117
- * @default false
114
+ /**
115
+ * An internal constant to indicate whether we cull the meshopt wasm module and asm.js module.
116
+ *
117
+ * @default false
118
118
  */
119
119
  CULL_MESHOPT: boolean;
120
- /**
121
- * An internal constant to indicate whether we use wasm assets as minigame subpackage.
122
- * This is useful when we need to reduce code size.
120
+ /**
121
+ * An internal constant to indicate whether we use wasm assets as minigame subpackage.
122
+ * This is useful when we need to reduce code size.
123
123
  */
124
124
  WASM_SUBPACKAGE: boolean;
125
- /**
126
- * An internal constant to indicate whether we're using 3D modules.
125
+ /**
126
+ * An internal constant to indicate whether we're using 3D modules.
127
127
  */
128
128
  USE_3D: boolean;
129
- /**
130
- * An internal constant to indicate whether we're using ui skew module.
129
+ /**
130
+ * An internal constant to indicate whether we're using ui skew module.
131
131
  */
132
132
  USE_UI_SKEW: boolean;
133
133
  }
@@ -46,13 +46,13 @@ const json5_1 = __importDefault(require("json5"));
46
46
  const dedent_1 = __importDefault(require("dedent"));
47
47
  const ConfigInterface = __importStar(require("./config-interface"));
48
48
  exports.ConfigInterface = ConfigInterface;
49
- /**
50
- * Query any any stats of the engine.
51
- * @group Merged Types
49
+ /**
50
+ * Query any any stats of the engine.
51
+ * @group Merged Types
52
52
  */
53
53
  class StatsQuery {
54
- /**
55
- * @param engine Path to the engine root.
54
+ /**
55
+ * @param engine Path to the engine root.
56
56
  */
57
57
  static async create(engine) {
58
58
  const configFile = path_1.default.join(engine, 'cc.config.json');
@@ -63,39 +63,39 @@ class StatsQuery {
63
63
  await query._initialize();
64
64
  return query;
65
65
  }
66
- /**
67
- * Gets the path to the engine root.
66
+ /**
67
+ * Gets the path to the engine root.
68
68
  */
69
69
  get path() {
70
70
  return this._engine;
71
71
  }
72
- /**
73
- * Gets the path to tsconfig.
72
+ /**
73
+ * Gets the path to tsconfig.
74
74
  */
75
75
  get tsConfigPath() {
76
76
  return path_1.default.join(this._engine, 'tsconfig.json');
77
77
  }
78
- /**
79
- * Gets all optimzie decorators
78
+ /**
79
+ * Gets all optimzie decorators
80
80
  */
81
81
  getOptimizeDecorators() {
82
82
  return this._config.optimizeDecorators;
83
83
  }
84
- /**
85
- * Gets TreeShake config
84
+ /**
85
+ * Gets TreeShake config
86
86
  */
87
87
  getTreeShakeConfig() {
88
88
  return this._config.treeShake;
89
89
  }
90
- /**
91
- * Gets all features defined.
90
+ /**
91
+ * Gets all features defined.
92
92
  */
93
93
  getFeatures() {
94
94
  return Object.keys(this._features);
95
95
  }
96
- /**
97
- * Returns if the specified feature is defined.
98
- * @param feature Feature ID.
96
+ /**
97
+ * Returns if the specified feature is defined.
98
+ * @param feature Feature ID.
99
99
  */
100
100
  hasFeature(feature) {
101
101
  return !!this._features[feature];
@@ -104,9 +104,9 @@ class StatsQuery {
104
104
  // public isNativeOnlyFeature (feature: string) {
105
105
  // return !!this._features[feature].isNativeOnly;
106
106
  // }
107
- /**
108
- * Gets all feature units included in specified features.
109
- * @param featureIds Feature ID.
107
+ /**
108
+ * Gets all feature units included in specified features.
109
+ * @param featureIds Feature ID.
110
110
  */
111
111
  getUnitsOfFeatures(featureIds) {
112
112
  var _a;
@@ -138,36 +138,36 @@ class StatsQuery {
138
138
  }
139
139
  return constants;
140
140
  }
141
- /**
142
- * Gets all feature units in their names.
141
+ /**
142
+ * Gets all feature units in their names.
143
143
  */
144
144
  getFeatureUnits() {
145
145
  return Object.keys(this._featureUnits);
146
146
  }
147
- /**
148
- * Gets the path to source file of the feature unit.
149
- * @param moduleId Name of the feature unit.
147
+ /**
148
+ * Gets the path to source file of the feature unit.
149
+ * @param moduleId Name of the feature unit.
150
150
  */
151
151
  getFeatureUnitFile(featureUnit) {
152
152
  return this._featureUnits[featureUnit];
153
153
  }
154
- /**
155
- * Gets all editor public modules in their names.
154
+ /**
155
+ * Gets all editor public modules in their names.
156
156
  */
157
157
  getEditorPublicModules() {
158
158
  return Object.keys(this._editorPublicModules);
159
159
  }
160
- /**
161
- * Gets the path to source file of the editor-public module.
162
- * @param moduleName Name of the public module.
160
+ /**
161
+ * Gets the path to source file of the editor-public module.
162
+ * @param moduleName Name of the public module.
163
163
  */
164
164
  getEditorPublicModuleFile(moduleName) {
165
165
  return this._editorPublicModules[moduleName];
166
166
  }
167
- /**
168
- * Gets the source of `'cc'`.
169
- * @param featureUnits Involved feature units.
170
- * @param mapper If exists, map the feature unit name into another module request.
167
+ /**
168
+ * Gets the source of `'cc'`.
169
+ * @param featureUnits Involved feature units.
170
+ * @param mapper If exists, map the feature unit name into another module request.
171
171
  */
172
172
  evaluateIndexModuleSource(featureUnits, mapper) {
173
173
  return featureUnits.map(featureUnit => {
@@ -183,16 +183,16 @@ class StatsQuery {
183
183
  return `export * from '${(_b = mapper === null || mapper === void 0 ? void 0 : mapper(featureUnit)) !== null && _b !== void 0 ? _b : featureUnit}';`;
184
184
  }).join('\n');
185
185
  }
186
- /**
187
- * Evaluates the source of `'internal-constants'`(`'cc/env'`),
188
- * @param context
186
+ /**
187
+ * Evaluates the source of `'internal-constants'`(`'cc/env'`),
188
+ * @param context
189
189
  */
190
190
  evaluateEnvModuleSourceFromRecord(record) {
191
191
  return Object.entries(record).map(([k, v]) => `export const ${k} = ${v};`).join('\n');
192
192
  }
193
- /**
194
- * Evaluates module overrides under specified context.
195
- * @param context
193
+ /**
194
+ * Evaluates module overrides under specified context.
195
+ * @param context
196
196
  */
197
197
  evaluateModuleOverrides(context) {
198
198
  var _a;
@@ -301,8 +301,8 @@ class StatsQuery {
301
301
  }
302
302
  }
303
303
  exports.StatsQuery = StatsQuery;
304
- /**
305
- * @group Merged Types
304
+ /**
305
+ * @group Merged Types
306
306
  */
307
307
  (function (StatsQuery) {
308
308
  class ConstantManager {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocos/ccbuild",
3
- "version": "2.3.17",
3
+ "version": "2.3.19",
4
4
  "description": "The next generation of build tool for Cocos engine.",
5
5
  "main": "./lib/src/index.js",
6
6
  "types": "./lib/src/index.d.ts",
@@ -1,13 +1,13 @@
1
- function defined (name) {
2
- const _global = typeof window === 'undefined' ? global : window;
3
- return typeof _global[name] === 'object';
4
- }
5
-
6
- export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
7
- export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
8
- export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
9
- export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
10
- export const NATIVE = JSB;
11
- export const HTML5 = !(EDITOR && NATIVE);
12
- export const DEV = tryDefineGlobal('CC_DEV', true);
13
- export const EDITOR_NOT_IN_PREVIEW = EDITOR && !tryDefineGlobal('isPreviewProcess',false);
1
+ function defined (name) {
2
+ const _global = typeof window === 'undefined' ? global : window;
3
+ return typeof _global[name] === 'object';
4
+ }
5
+
6
+ export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
7
+ export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
8
+ export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
9
+ export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
10
+ export const NATIVE = JSB;
11
+ export const HTML5 = !(EDITOR && NATIVE);
12
+ export const DEV = tryDefineGlobal('CC_DEV', true);
13
+ export const EDITOR_NOT_IN_PREVIEW = EDITOR && !tryDefineGlobal('isPreviewProcess',false);
@@ -1,21 +1,21 @@
1
-
2
- /**
3
- * TsPropertyDecorator cannot access the property descriptor, sometimes we need to access the initializer in property descriptor.
4
- * This helper helps receive the initializer from EngineCompiler, and generate a BabelPropertyDecorator in runtime.
5
- * @param decoratorOrFactory A TsPropertyDecorator or a decorator factory
6
- * @param initializer the property initializer generate from engine compiler
7
- * @param factoryArgs if `decoratorOrFactory` is a factory, then we may need some arguments for this factory method.
8
- * @returns BabelPropertyDecorator
9
- */
10
- export function CCBuildTsFieldDecoratorHelper (decoratorOrFactory: Function, initializer: Function | null, ...factoryArgs: any[]): PropertyDecorator {
11
- if (factoryArgs.length > 0) {
12
- const decorator = decoratorOrFactory(...factoryArgs);
13
- return (target, propertyKey) => {
14
- decorator(target, propertyKey, initializer);
15
- };
16
- } else {
17
- return (target, propertyKey) => {
18
- decoratorOrFactory(target, propertyKey, initializer);
19
- };
20
- }
1
+
2
+ /**
3
+ * TsPropertyDecorator cannot access the property descriptor, sometimes we need to access the initializer in property descriptor.
4
+ * This helper helps receive the initializer from EngineCompiler, and generate a BabelPropertyDecorator in runtime.
5
+ * @param decoratorOrFactory A TsPropertyDecorator or a decorator factory
6
+ * @param initializer the property initializer generate from engine compiler
7
+ * @param factoryArgs if `decoratorOrFactory` is a factory, then we may need some arguments for this factory method.
8
+ * @returns BabelPropertyDecorator
9
+ */
10
+ export function CCBuildTsFieldDecoratorHelper (decoratorOrFactory: Function, initializer: Function | null, ...factoryArgs: any[]): PropertyDecorator {
11
+ if (factoryArgs.length > 0) {
12
+ const decorator = decoratorOrFactory(...factoryArgs);
13
+ return (target, propertyKey) => {
14
+ decorator(target, propertyKey, initializer);
15
+ };
16
+ } else {
17
+ return (target, propertyKey) => {
18
+ decoratorOrFactory(target, propertyKey, initializer);
19
+ };
20
+ }
21
21
  }
@@ -1,9 +1,9 @@
1
- function tryDefineGlobal (name, value) {
2
- const _global = typeof window === 'undefined' ? global : window;
3
- if (typeof _global[name] === 'undefined') {
4
- return (_global[name] = value);
5
- } else {
6
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
7
- return _global[name];
8
- }
1
+ function tryDefineGlobal (name, value) {
2
+ const _global = typeof window === 'undefined' ? global : window;
3
+ if (typeof _global[name] === 'undefined') {
4
+ return (_global[name] = value);
5
+ } else {
6
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
7
+ return _global[name];
8
+ }
9
9
  }