@cocos/ccbuild 2.0.3-alpha.12 → 2.0.3-alpha.13

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 (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +16 -16
  3. package/modules/build-engine/lib/build-dts.d.ts +7 -0
  4. package/modules/build-engine/lib/build-dts.d.ts.map +1 -0
  5. package/modules/build-engine/lib/build-dts.js +297 -0
  6. package/modules/build-engine/lib/build-dts.js.map +1 -0
  7. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.d.ts +35 -35
  8. package/modules/build-engine/lib/engine-js/rollup-plugins/external-wasm-loader.js +10 -10
  9. package/modules/build-engine/lib/engine-ts/engine-builder.d.ts.map +1 -1
  10. package/modules/build-engine/lib/engine-ts/engine-builder.js +59 -3
  11. package/modules/build-engine/lib/engine-ts/engine-builder.js.map +1 -1
  12. package/modules/build-engine/lib/engine-ts/plugins/external-wasm-loader.d.ts +2 -2
  13. package/modules/build-engine/lib/engine-ts/plugins/interface.d.ts +14 -14
  14. package/modules/build-engine/lib/index.d.ts +94 -94
  15. package/modules/build-engine/lib/index.js +16 -16
  16. package/modules/dts-bundler/lib/index.js +5 -5
  17. package/modules/modularize/lib/module-config.d.ts +70 -70
  18. package/modules/modularize/lib/module-query.d.ts +25 -25
  19. package/modules/modularize/lib/module-query.js +13 -13
  20. package/modules/modularize/lib/platform-config.d.ts +8 -8
  21. package/modules/modularize/lib/platform-config.js +8 -8
  22. package/modules/stats-query/lib/config-interface.d.ts +61 -61
  23. package/modules/stats-query/lib/index.d.ts +61 -61
  24. package/modules/stats-query/lib/index.js +41 -41
  25. package/package.json +1 -1
  26. package/static/helper-dynamic-constants.txt +13 -13
  27. package/static/helper-file-decorator.ts +20 -20
  28. package/static/helper-global-exporter.txt +8 -8
  29. package/static/lib.dom.d.ts +2330 -2330
@@ -2,78 +2,78 @@ import { Context } 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 all features defined.
30
+ /**
31
+ * Gets all features defined.
32
32
  */
33
33
  getFeatures(): string[];
34
- /**
35
- * Returns if the specified feature is defined.
36
- * @param feature Feature ID.
34
+ /**
35
+ * Returns if the specified feature is defined.
36
+ * @param feature Feature ID.
37
37
  */
38
38
  hasFeature(feature: string): boolean;
39
- /**
40
- * Gets all feature units included in specified features.
41
- * @param featureIds Feature ID.
39
+ /**
40
+ * Gets all feature units included in specified features.
41
+ * @param featureIds Feature ID.
42
42
  */
43
43
  getUnitsOfFeatures(featureIds: string[]): string[];
44
44
  getIntrinsicFlagsOfFeatures(featureIds: string[]): Record<string, number | boolean | string>;
45
- /**
46
- * Gets all feature units in their names.
45
+ /**
46
+ * Gets all feature units in their names.
47
47
  */
48
48
  getFeatureUnits(): string[];
49
- /**
50
- * Gets the path to source file of the feature unit.
51
- * @param moduleId Name of the feature unit.
49
+ /**
50
+ * Gets the path to source file of the feature unit.
51
+ * @param moduleId Name of the feature unit.
52
52
  */
53
53
  getFeatureUnitFile(featureUnit: string): string;
54
- /**
55
- * Gets all editor public modules in their names.
54
+ /**
55
+ * Gets all editor public modules in their names.
56
56
  */
57
57
  getEditorPublicModules(): string[];
58
- /**
59
- * Gets the path to source file of the editor-public module.
60
- * @param moduleName Name of the public module.
58
+ /**
59
+ * Gets the path to source file of the editor-public module.
60
+ * @param moduleName Name of the public module.
61
61
  */
62
62
  getEditorPublicModuleFile(moduleName: string): string;
63
- /**
64
- * Gets the source of `'cc'`.
65
- * @param featureUnits Involved feature units.
66
- * @param mapper If exists, map the feature unit name into another module request.
63
+ /**
64
+ * Gets the source of `'cc'`.
65
+ * @param featureUnits Involved feature units.
66
+ * @param mapper If exists, map the feature unit name into another module request.
67
67
  */
68
68
  evaluateIndexModuleSource(featureUnits: string[], mapper?: (featureUnit: string) => string): string;
69
- /**
70
- * Evaluates the source of `'internal-constants'`(`'cc/env'`),
71
- * @param context
69
+ /**
70
+ * Evaluates the source of `'internal-constants'`(`'cc/env'`),
71
+ * @param context
72
72
  */
73
73
  evaluateEnvModuleSourceFromRecord(record: Record<string, unknown>): string;
74
- /**
75
- * Evaluates module overrides under specified context.
76
- * @param context
74
+ /**
75
+ * Evaluates module overrides under specified context.
76
+ * @param context
77
77
  */
78
78
  evaluateModuleOverrides(context: Context): Record<string, string>;
79
79
  private static _readModulesInDir;
@@ -90,8 +90,8 @@ export declare class StatsQuery {
90
90
  private _featureUnits;
91
91
  private _editorPublicModules;
92
92
  }
93
- /**
94
- * @group Merged Types
93
+ /**
94
+ * @group Merged Types
95
95
  */
96
96
  export declare namespace StatsQuery {
97
97
  namespace ConstantManager {
@@ -103,30 +103,30 @@ export declare namespace StatsQuery {
103
103
  WEBGPU: boolean;
104
104
  WASM_SUPPORT_MODE: number;
105
105
  FORCE_BANNING_BULLET_WASM: boolean;
106
- /**
107
- * Whether cull the asm.js module.
108
- * If this is true, the external modules ending with '.asm.js' or 'js.mem' will be culled.
109
- *
110
- * @default false
106
+ /**
107
+ * Whether cull the asm.js module.
108
+ * If this is true, the external modules ending with '.asm.js' or 'js.mem' will be culled.
109
+ *
110
+ * @default false
111
111
  */
112
112
  CULL_ASM_JS_MODULE: boolean;
113
- /**
114
- * An internal constant to indicate whether we cull the meshopt wasm module and asm.js module.
115
- *
116
- * @default false
113
+ /**
114
+ * An internal constant to indicate whether we cull the meshopt wasm module and asm.js module.
115
+ *
116
+ * @default false
117
117
  */
118
118
  CULL_MESHOPT: boolean;
119
- /**
120
- * An internal constant to indicate whether need a fallback of wasm.
121
- * If true, we build a wasm fallback module for the compatibility of wasm files compiled by different version of emscripten.
122
- * This is useful when we use wasm on different version of Safari browsers.
123
- *
124
- * @default false
119
+ /**
120
+ * An internal constant to indicate whether need a fallback of wasm.
121
+ * If true, we build a wasm fallback module for the compatibility of wasm files compiled by different version of emscripten.
122
+ * This is useful when we use wasm on different version of Safari browsers.
123
+ *
124
+ * @default false
125
125
  */
126
126
  WASM_FALLBACK: boolean;
127
- /**
128
- * An internal constant to indicate whether we use wasm assets as minigame subpackage.
129
- * This is useful when we need to reduce code size.
127
+ /**
128
+ * An internal constant to indicate whether we use wasm assets as minigame subpackage.
129
+ * This is useful when we need to reduce code size.
130
130
  */
131
131
  WASM_SUBPACKAGE: boolean;
132
132
  }
@@ -73,13 +73,13 @@ const json5_1 = __importDefault(require("json5"));
73
73
  const dedent_1 = __importDefault(require("dedent"));
74
74
  const ConfigInterface = __importStar(require("./config-interface"));
75
75
  exports.ConfigInterface = ConfigInterface;
76
- /**
77
- * Query any any stats of the engine.
78
- * @group Merged Types
76
+ /**
77
+ * Query any any stats of the engine.
78
+ * @group Merged Types
79
79
  */
80
80
  class StatsQuery {
81
- /**
82
- * @param engine Path to the engine root.
81
+ /**
82
+ * @param engine Path to the engine root.
83
83
  */
84
84
  static create(engine) {
85
85
  return __awaiter(this, void 0, void 0, function* () {
@@ -92,33 +92,33 @@ class StatsQuery {
92
92
  return query;
93
93
  });
94
94
  }
95
- /**
96
- * Gets the path to the engine root.
95
+ /**
96
+ * Gets the path to the engine root.
97
97
  */
98
98
  get path() {
99
99
  return this._engine;
100
100
  }
101
- /**
102
- * Gets the path to tsconfig.
101
+ /**
102
+ * Gets the path to tsconfig.
103
103
  */
104
104
  get tsConfigPath() {
105
105
  return path_1.default.join(this._engine, 'tsconfig.json');
106
106
  }
107
- /**
108
- * Gets all optimzie decorators
107
+ /**
108
+ * Gets all optimzie decorators
109
109
  */
110
110
  getOptimizeDecorators() {
111
111
  return this._config.optimizeDecorators;
112
112
  }
113
- /**
114
- * Gets all features defined.
113
+ /**
114
+ * Gets all features defined.
115
115
  */
116
116
  getFeatures() {
117
117
  return Object.keys(this._features);
118
118
  }
119
- /**
120
- * Returns if the specified feature is defined.
121
- * @param feature Feature ID.
119
+ /**
120
+ * Returns if the specified feature is defined.
121
+ * @param feature Feature ID.
122
122
  */
123
123
  hasFeature(feature) {
124
124
  return !!this._features[feature];
@@ -127,9 +127,9 @@ class StatsQuery {
127
127
  // public isNativeOnlyFeature (feature: string) {
128
128
  // return !!this._features[feature].isNativeOnly;
129
129
  // }
130
- /**
131
- * Gets all feature units included in specified features.
132
- * @param featureIds Feature ID.
130
+ /**
131
+ * Gets all feature units included in specified features.
132
+ * @param featureIds Feature ID.
133
133
  */
134
134
  getUnitsOfFeatures(featureIds) {
135
135
  var _a;
@@ -150,36 +150,36 @@ class StatsQuery {
150
150
  }
151
151
  return flags;
152
152
  }
153
- /**
154
- * Gets all feature units in their names.
153
+ /**
154
+ * Gets all feature units in their names.
155
155
  */
156
156
  getFeatureUnits() {
157
157
  return Object.keys(this._featureUnits);
158
158
  }
159
- /**
160
- * Gets the path to source file of the feature unit.
161
- * @param moduleId Name of the feature unit.
159
+ /**
160
+ * Gets the path to source file of the feature unit.
161
+ * @param moduleId Name of the feature unit.
162
162
  */
163
163
  getFeatureUnitFile(featureUnit) {
164
164
  return this._featureUnits[featureUnit];
165
165
  }
166
- /**
167
- * Gets all editor public modules in their names.
166
+ /**
167
+ * Gets all editor public modules in their names.
168
168
  */
169
169
  getEditorPublicModules() {
170
170
  return Object.keys(this._editorPublicModules);
171
171
  }
172
- /**
173
- * Gets the path to source file of the editor-public module.
174
- * @param moduleName Name of the public module.
172
+ /**
173
+ * Gets the path to source file of the editor-public module.
174
+ * @param moduleName Name of the public module.
175
175
  */
176
176
  getEditorPublicModuleFile(moduleName) {
177
177
  return this._editorPublicModules[moduleName];
178
178
  }
179
- /**
180
- * Gets the source of `'cc'`.
181
- * @param featureUnits Involved feature units.
182
- * @param mapper If exists, map the feature unit name into another module request.
179
+ /**
180
+ * Gets the source of `'cc'`.
181
+ * @param featureUnits Involved feature units.
182
+ * @param mapper If exists, map the feature unit name into another module request.
183
183
  */
184
184
  evaluateIndexModuleSource(featureUnits, mapper) {
185
185
  return featureUnits.map(featureUnit => {
@@ -195,16 +195,16 @@ class StatsQuery {
195
195
  return `export * from '${(_b = mapper === null || mapper === void 0 ? void 0 : mapper(featureUnit)) !== null && _b !== void 0 ? _b : featureUnit}';`;
196
196
  }).join('\n');
197
197
  }
198
- /**
199
- * Evaluates the source of `'internal-constants'`(`'cc/env'`),
200
- * @param context
198
+ /**
199
+ * Evaluates the source of `'internal-constants'`(`'cc/env'`),
200
+ * @param context
201
201
  */
202
202
  evaluateEnvModuleSourceFromRecord(record) {
203
203
  return Object.entries(record).map(([k, v]) => `export const ${k} = ${v};`).join('\n');
204
204
  }
205
- /**
206
- * Evaluates module overrides under specified context.
207
- * @param context
205
+ /**
206
+ * Evaluates module overrides under specified context.
207
+ * @param context
208
208
  */
209
209
  evaluateModuleOverrides(context) {
210
210
  var _a;
@@ -316,8 +316,8 @@ class StatsQuery {
316
316
  }
317
317
  }
318
318
  exports.StatsQuery = StatsQuery;
319
- /**
320
- * @group Merged Types
319
+ /**
320
+ * @group Merged Types
321
321
  */
322
322
  (function (StatsQuery) {
323
323
  class ConstantManager {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocos/ccbuild",
3
- "version": "2.0.3-alpha.12",
3
+ "version": "2.0.3-alpha.13",
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
  }