@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log - @cocos/ccbuild
2
2
 
3
+ ## 2.3.18
4
+
5
+ ### Patch Changes
6
+
7
+ - export USE_SORTING_2D
8
+
3
9
  ## 2.0.3
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # CCBUILD
2
-
3
- The next generation of build tool for Cocos engine.
4
-
5
- # What problems does this build tool solve ?
6
-
7
- - To merge `@editor/quick-compiler` and `@cocos/build-engine`
8
- - To support build cache management
9
- - To support generating ts engine for AOT optimization on Open Harmony
10
- - To support API generation
11
- - To support API report
12
- - To support API document model generation
13
- - To support build modular engine
14
- - More human-friendly log info
15
-
16
- > [I am a maintainer of this repo](https://github.com/cocos/cocos-ccbuild/blob/master/README_MAINTAIN.md)
1
+ # CCBUILD
2
+
3
+ The next generation of build tool for Cocos engine.
4
+
5
+ # What problems does this build tool solve ?
6
+
7
+ - To merge `@editor/quick-compiler` and `@cocos/build-engine`
8
+ - To support build cache management
9
+ - To support generating ts engine for AOT optimization on Open Harmony
10
+ - To support API generation
11
+ - To support API report
12
+ - To support API document model generation
13
+ - To support build modular engine
14
+ - More human-friendly log info
15
+
16
+ > [I am a maintainer of this repo](https://github.com/cocos/cocos-ccbuild/blob/master/README_MAINTAIN.md)
@@ -65,8 +65,8 @@ function getParentNodes(path) {
65
65
  function isInFunctionDeclaration(path) {
66
66
  return getParentNodes(path.parentPath).some(parent => parent.type === 'FunctionDeclaration');
67
67
  }
68
- /**
69
- * collectt all variables which is defined outside current function and save into `ctx`
68
+ /**
69
+ * collectt all variables which is defined outside current function and save into `ctx`
70
70
  */
71
71
  function collectGlobalVars(code, oldPath, ctx) {
72
72
  try {
@@ -98,8 +98,8 @@ function collectGlobalVars(code, oldPath, ctx) {
98
98
  }
99
99
  }
100
100
  }
101
- /**
102
- * convert decorators to `DecoratorParsedResult[]`
101
+ /**
102
+ * convert decorators to `DecoratorParsedResult[]`
103
103
  */
104
104
  function parseNodeDecorators(targetNode, decorators, classCtx) {
105
105
  var _a, _b;
@@ -177,8 +177,8 @@ function mergeArray(dst, src) {
177
177
  }
178
178
  }
179
179
  }
180
- /**
181
- * generate variable names for property descriptors
180
+ /**
181
+ * generate variable names for property descriptors
182
182
  */
183
183
  function allocPropVariable(className, property) {
184
184
  return `${property}Descriptor`;
@@ -191,14 +191,14 @@ function nameDecorators(name) {
191
191
  }
192
192
  return `$.${name}`;
193
193
  }
194
- /**
195
- * convert class decorator to text
194
+ /**
195
+ * convert class decorator to text
196
196
  */
197
197
  function cvtClassDecorators(className) {
198
198
  return d => ` ${nameDecorators(d.decoratorName)}${d.decoratorArgs ? `(${d.decoratorArgs.join(',')})` : ''}(${className})`;
199
199
  }
200
- /**
201
- * convert property decorator to text
200
+ /**
201
+ * convert property decorator to text
202
202
  */
203
203
  function cvtPropDecorators(className, ctx) {
204
204
  return d => {
@@ -1,17 +1,17 @@
1
1
  import type { OptionsResolved } from './options';
2
- /**
3
- * Represents the scan options for the enum.
2
+ /**
3
+ * Represents the scan options for the enum.
4
4
  */
5
5
  export type ScanOptions = Pick<OptionsResolved, 'scanDir' | 'scanMode' | 'scanPattern'>;
6
- /**
7
- * Represents a member of an enum.
6
+ /**
7
+ * Represents a member of an enum.
8
8
  */
9
9
  export interface EnumMember {
10
10
  readonly name: string;
11
11
  readonly value: string | number;
12
12
  }
13
- /**
14
- * Represents a declaration of an enum.
13
+ /**
14
+ * Represents a declaration of an enum.
15
15
  */
16
16
  export interface EnumDeclaration {
17
17
  readonly id: string;
@@ -22,8 +22,8 @@ export interface EnumDeclaration {
22
22
  export interface IDefines {
23
23
  [id_key: `${string}.${string}`]: string | number;
24
24
  }
25
- /**
26
- * Represents the data of all enums.
25
+ /**
26
+ * Represents the data of all enums.
27
27
  */
28
28
  export interface EnumData {
29
29
  readonly declarations: {
@@ -31,9 +31,9 @@ export interface EnumData {
31
31
  };
32
32
  readonly defines: IDefines;
33
33
  }
34
- /**
35
- * Scans the specified directory for enums based on the provided options.
36
- * @param options - The scan options for the enum.
37
- * @returns The data of all enums found.
34
+ /**
35
+ * Scans the specified directory for enums based on the provided options.
36
+ * @param options - The scan options for the enum.
37
+ * @returns The data of all enums found.
38
38
  */
39
39
  export declare function scanEnums(options: ScanOptions): Promise<EnumData>;
@@ -16,10 +16,10 @@ const node_assert_1 = __importDefault(require("node:assert"));
16
16
  const node_fs_1 = require("node:fs");
17
17
  const ast_kit_1 = require("ast-kit");
18
18
  const fast_glob_1 = __importDefault(require("fast-glob"));
19
- /**
20
- * Evaluates a JavaScript expression and returns the result.
21
- * @param exp - The expression to evaluate.
22
- * @returns The evaluated result.
19
+ /**
20
+ * Evaluates a JavaScript expression and returns the result.
21
+ * @param exp - The expression to evaluate.
22
+ * @returns The evaluated result.
23
23
  */
24
24
  function evaluate(exp) {
25
25
  try {
@@ -299,10 +299,10 @@ async function handleOneTsFile(file, declarations, defines, wait, resolve) {
299
299
  });
300
300
  }
301
301
  }
302
- /**
303
- * Scans the specified directory for enums based on the provided options.
304
- * @param options - The scan options for the enum.
305
- * @returns The data of all enums found.
302
+ /**
303
+ * Scans the specified directory for enums based on the provided options.
304
+ * @param options - The scan options for the enum.
305
+ * @returns The data of all enums found.
306
306
  */
307
307
  async function scanEnums(options) {
308
308
  const declarations = Object.create(null);
@@ -339,10 +339,10 @@ async function scanEnums(options) {
339
339
  return enumData;
340
340
  }
341
341
  exports.scanEnums = scanEnums;
342
- /**
343
- * Scans the specified directory for files based on the provided options.
344
- * @param options - The scan options for the files.
345
- * @returns The list of files found.
342
+ /**
343
+ * Scans the specified directory for files based on the provided options.
344
+ * @param options - The scan options for the files.
345
+ * @returns The list of files found.
346
346
  */
347
347
  function scanFiles(options) {
348
348
  return fast_glob_1.default.sync(options.scanPattern, {
@@ -1,37 +1,37 @@
1
1
  import type { FilterPattern } from '@rollup/pluginutils';
2
- /**
3
- * Represents the options for the plugin.
2
+ /**
3
+ * Represents the options for the plugin.
4
4
  */
5
5
  export interface Options {
6
6
  include?: FilterPattern;
7
7
  exclude?: FilterPattern;
8
8
  enforce?: 'pre' | 'post' | undefined;
9
- /**
10
- * The mode used to scan for enum files.
11
- * @default 'fs'
9
+ /**
10
+ * The mode used to scan for enum files.
11
+ * @default 'fs'
12
12
  */
13
13
  scanMode?: 'git' | 'fs';
14
- /**
15
- * The directory to scan for enum files.
16
- * @default process.cwd()
14
+ /**
15
+ * The directory to scan for enum files.
16
+ * @default process.cwd()
17
17
  */
18
18
  scanDir?: string;
19
- /**
20
- * The pattern used to match enum files.
21
- * @default '**\/*.{cts,mts,ts,tsx}'
19
+ /**
20
+ * The pattern used to match enum files.
21
+ * @default '**\/*.{cts,mts,ts,tsx}'
22
22
  */
23
23
  scanPattern?: string | string[];
24
24
  moduleOverrides?: Record<string, string> | null;
25
25
  }
26
26
  type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
27
- /**
28
- * Represents the resolved options for the plugin.
27
+ /**
28
+ * Represents the resolved options for the plugin.
29
29
  */
30
30
  export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, 'enforce'>>;
31
- /**
32
- * Resolves the options for the plugin.
33
- * @param options - The options to resolve.
34
- * @returns The resolved options.
31
+ /**
32
+ * Resolves the options for the plugin.
33
+ * @param options - The options to resolve.
34
+ * @returns The resolved options.
35
35
  */
36
36
  export declare function resolveOptions(options: Options): OptionsResolved;
37
37
  export {};
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", {
10
10
  });
11
11
  exports.resolveOptions = void 0;
12
12
  const node_process_1 = __importDefault(require("node:process"));
13
- /**
14
- * Resolves the options for the plugin.
15
- * @param options - The options to resolve.
16
- * @returns The resolved options.
13
+ /**
14
+ * Resolves the options for the plugin.
15
+ * @param options - The options to resolve.
16
+ * @returns The resolved options.
17
17
  */
18
18
  function resolveOptions(options) {
19
19
  return {
@@ -3,7 +3,7 @@ import { EnumData } from './core/enum';
3
3
  import { rollup as Bundler } from "../../../../../bundler/lib/index";
4
4
  import rollup = Bundler.core;
5
5
  export declare function getEnumData(): EnumData | undefined;
6
- /**
7
- * The main unplugin instance.
6
+ /**
7
+ * The main unplugin instance.
8
8
  */
9
9
  export declare function rpEnumScanner(rawOptions: Options): Promise<rollup.Plugin[]>;
@@ -11,8 +11,8 @@ function getEnumData() {
11
11
  return enumData;
12
12
  }
13
13
  exports.getEnumData = getEnumData;
14
- /**
15
- * The main unplugin instance.
14
+ /**
15
+ * The main unplugin instance.
16
16
  */
17
17
  async function rpEnumScanner(rawOptions) {
18
18
  const options = (0, options_1.resolveOptions)(rawOptions);
@@ -1,51 +1,51 @@
1
1
  import { rollup as Bundler } from "../../../../bundler/lib/index";
2
2
  import rollup = Bundler.core;
3
- /**
4
- * This plugin enable to load script or wasm with url based on 'external://' origin.
3
+ /**
4
+ * This plugin enable to load script or wasm with url based on 'external://' origin.
5
5
  */
6
6
  export declare function externalWasmLoader(options: externalWasmLoader.Options): rollup.Plugin;
7
7
  export declare namespace externalWasmLoader {
8
8
  interface Options {
9
- /**
10
- * The root path of external repository
9
+ /**
10
+ * The root path of external repository
11
11
  */
12
12
  externalRoot: string;
13
- /**
14
- * The bundle mode of native code while building scripts.
13
+ /**
14
+ * The bundle mode of native code while building scripts.
15
15
  */
16
16
  nativeCodeBundleMode: 'wasm' | 'asmjs' | 'both';
17
- /**
18
- * Wasm compression mode, 'brotli' means to compress .wasm to .wasm.br.
19
- * @note Currently, only WeChat and ByteDance mini-game support to load '.wasm.br' file.
17
+ /**
18
+ * Wasm compression mode, 'brotli' means to compress .wasm to .wasm.br.
19
+ * @note Currently, only WeChat and ByteDance mini-game support to load '.wasm.br' file.
20
20
  */
21
21
  wasmCompressionMode?: 'brotli';
22
- /**
23
- * Whether cull meshopt module, including wasm and asm.js.
22
+ /**
23
+ * Whether cull meshopt module, including wasm and asm.js.
24
24
  */
25
25
  cullMeshopt: boolean;
26
- /**
27
- * Build external wasm module as minigame subpackage.
28
- * This feature is for minigame platforms.
26
+ /**
27
+ * Build external wasm module as minigame subpackage.
28
+ * This feature is for minigame platforms.
29
29
  */
30
30
  wasmSubpackage: boolean;
31
31
  format?: Format;
32
32
  }
33
- /**
34
- * How to generate the reference to external assets:
35
- * - `'relative-from-out'`
36
- * Generate the path relative from `out` directory, does not contain the leading './'.
37
- *
38
- * - `'relative-from-chunk'`
39
- * Generate the path relative from the referencing output chunk.
40
- *
41
- * - `'dynamic'`(default)
42
- * Use runtime `URL` API to resolve the absolute URL.
43
- * This requires `URL` and `import.meta.url` to be valid.
33
+ /**
34
+ * How to generate the reference to external assets:
35
+ * - `'relative-from-out'`
36
+ * Generate the path relative from `out` directory, does not contain the leading './'.
37
+ *
38
+ * - `'relative-from-chunk'`
39
+ * Generate the path relative from the referencing output chunk.
40
+ *
41
+ * - `'dynamic'`(default)
42
+ * Use runtime `URL` API to resolve the absolute URL.
43
+ * This requires `URL` and `import.meta.url` to be valid.
44
44
  */
45
45
  type Format = 'relative-from-out' | 'relative-from-chunk' | 'runtime-resolved';
46
46
  }
47
- /**
48
- * Convert the file path to asset ref URL.
49
- * @param file File path in absolute.
47
+ /**
48
+ * Convert the file path to asset ref URL.
49
+ * @param file File path in absolute.
50
50
  */
51
51
  export declare function pathToAssetRefURL(file: string): string;
@@ -29,8 +29,8 @@ function normalizePath(path) {
29
29
  const suffixReplaceConfig = {
30
30
  '.mem': '.mem.bin'
31
31
  };
32
- /**
33
- * emit asset and return the export statement
32
+ /**
33
+ * emit asset and return the export statement
34
34
  */
35
35
  async function emitAsset(context, filePath, options) {
36
36
  let basename = path_1.default.basename(filePath);
@@ -105,9 +105,9 @@ const loadConfig = {
105
105
  cullingContent: `export default function () {}`
106
106
  }
107
107
  };
108
- /**
109
- * This is a module bundler for minigame subpacakge.
110
- * We need an entry script called 'game.js' for each subpackage.
108
+ /**
109
+ * This is a module bundler for minigame subpacakge.
110
+ * We need an entry script called 'game.js' for each subpackage.
111
111
  */
112
112
  class ExternalWasmModuleBundler {
113
113
  constructor(options) {
@@ -205,8 +205,8 @@ class ExternalWasmModuleBundler {
205
205
  return result.join('\n');
206
206
  }
207
207
  }
208
- /**
209
- * This plugin enable to load script or wasm with url based on 'external://' origin.
208
+ /**
209
+ * This plugin enable to load script or wasm with url based on 'external://' origin.
210
210
  */
211
211
  function externalWasmLoader(options) {
212
212
  const externalWasmModules = [];
@@ -279,9 +279,9 @@ function externalWasmLoader(options) {
279
279
  };
280
280
  }
281
281
  exports.externalWasmLoader = externalWasmLoader;
282
- /**
283
- * Convert the file path to asset ref URL.
284
- * @param file File path in absolute.
282
+ /**
283
+ * Convert the file path to asset ref URL.
284
+ * @param file File path in absolute.
285
285
  */
286
286
  function pathToAssetRefURL(file) {
287
287
  return `${assetPrefix}${(0, url_1.pathToFileURL)(file).pathname}`;
@@ -1,7 +1,7 @@
1
1
  import * as ts from '@cocos/typescript';
2
2
  export interface IMinifierOptions {
3
- /**
4
- * Prefix of generated names (e.g. '_ccprivate$')
3
+ /**
4
+ * Prefix of generated names (e.g. '_ccprivate$')
5
5
  */
6
6
  prefix: string;
7
7
  mangleList: string[];
@@ -4,8 +4,8 @@ export declare namespace externalWasmLoaderFactory {
4
4
  interface Options {
5
5
  engineRoot: string;
6
6
  outDir?: string;
7
- /**
8
- * Whether cull meshopt module, including wasm and asm.js.
7
+ /**
8
+ * Whether cull meshopt module, including wasm and asm.js.
9
9
  */
10
10
  cullMeshopt: boolean;
11
11
  }
@@ -1,23 +1,23 @@
1
1
  export interface ITsEnginePlugin {
2
2
  buildStart?(): Promise<void>;
3
- /**
4
- * The hook to resolve id, return `null` if this plugin cannot handle this script.
5
- * This hook is to transform source to id, which is the exact file path we read from.
6
- * @param source
7
- * @param importer
3
+ /**
4
+ * The hook to resolve id, return `null` if this plugin cannot handle this script.
5
+ * This hook is to transform source to id, which is the exact file path we read from.
6
+ * @param source
7
+ * @param importer
8
8
  */
9
9
  resolve?(source: string, importer?: string): Promise<string | void>;
10
- /**
11
- * The hook to load script, return `null` if this plugin cannot handle this script.
12
- * This hook decide how we load the script content from the module id.
13
- * @param id
10
+ /**
11
+ * The hook to load script, return `null` if this plugin cannot handle this script.
12
+ * This hook decide how we load the script content from the module id.
13
+ * @param id
14
14
  */
15
15
  load?(id: string): Promise<string | void>;
16
- /**
17
- * The hook to transform id, return the absolute file path or null.
18
- * This hook is to transform module source to an override module id, which is for the output module id.
19
- * This output module id would also affect the import relative path in the output module.
20
- * @param source
16
+ /**
17
+ * The hook to transform id, return the absolute file path or null.
18
+ * This hook is to transform module source to an override module id, which is for the output module id.
19
+ * This output module id would also affect the import relative path in the output module.
20
+ * @param source
21
21
  */
22
22
  transformId?(source: string, importer?: string): string | void;
23
23
  buildEnd?(): Promise<void>;