diff --git a/.api/public.d.ts b/.api/public.d.ts index 9cd5f4c9..f93488cb 100644 --- a/.api/public.d.ts +++ b/.api/public.d.ts @@ -27,6 +27,16 @@ declare module "@cocos/ccbuild" { */ function enumerateAllDependents(meta: buildEngine.Result, featureUnits: string[]): string[]; export type ModuleFormat = "esm" | "cjs" | "system" | "iife"; + export interface IManglePropertiesOptions { + /** + * Prefix of generated names (default: '_ccprivate$') + */ + prefix?: string; + mangleList?: string[]; + dontMangleList?: string[]; + mangleGetterSetter?: boolean; + ignoreJsDocTag?: boolean; + } export interface Options { /** * 引擎仓库目录。 @@ -80,10 +90,10 @@ declare module "@cocos/ccbuild" { */ inlineEnum?: boolean; /** - * 是否需要压缩 $ 后缀的属性,只在 release 模式下生效 + * 是否需要压缩 private 属性。 * @default true */ - mangleProperties?: boolean; + mangleProperties?: boolean | IManglePropertiesOptions; /** * 是否生成 source map。 * 若为 `inline` 则生成内联的 source map。 @@ -714,149 +724,6 @@ declare module "@cocos/ccbuild" { */ createImportExpressions?: boolean; } - export interface GeneratorOptions { - /** - * Optional string to add as a block comment at the start of the output file. - */ - auxiliaryCommentBefore?: string | undefined; - /** - * Optional string to add as a block comment at the end of the output file. - */ - auxiliaryCommentAfter?: string | undefined; - /** - * Function that takes a comment (as a string) and returns true if the comment should be included in the output. - * By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment - * contains `@preserve` or `@license`. - */ - shouldPrintComment?(comment: string): boolean; - /** - * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces). - * Defaults to `false`. - */ - retainLines?: boolean | undefined; - /** - * Retain parens around function expressions (could be used to change engine parsing behavior) - * Defaults to `false`. - */ - retainFunctionParens?: boolean | undefined; - /** - * Should comments be included in output? Defaults to `true`. - */ - comments?: boolean | undefined; - /** - * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`. - */ - compact?: boolean | "auto" | undefined; - /** - * Should the output be minified. Defaults to `false`. - */ - minified?: boolean | undefined; - /** - * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`. - */ - concise?: boolean | undefined; - /** - * Used in warning messages - */ - filename?: string | undefined; - /** - * Enable generating source maps. Defaults to `false`. - */ - sourceMaps?: boolean | undefined; - /** - * A root for all relative URLs in the source map. - */ - sourceRoot?: string | undefined; - /** - * The filename for the source code (i.e. the code in the `code` argument). - * This will only be used if `code` is a string. - */ - sourceFileName?: string | undefined; - /** - * Set to true to run jsesc with "json": true to print "\u00A9" vs. "©"; - */ - jsonCompatibleStrings?: boolean | undefined; - /** - * Set to true to enable support for experimental decorators syntax before module exports. - * Defaults to `false`. - */ - decoratorsBeforeExport?: boolean | undefined; - /** - * Options for outputting jsesc representation. - */ - jsescOption?: { - /** - * The default value for the quotes option is 'single'. This means that any occurrences of ' in the input - * string are escaped as \', so that the output can be used in a string literal wrapped in single quotes. - */ - quotes?: "single" | "double" | "backtick" | undefined; - /** - * The default value for the numbers option is 'decimal'. This means that any numeric values are represented - * using decimal integer literals. Other valid options are binary, octal, and hexadecimal, which result in - * binary integer literals, octal integer literals, and hexadecimal integer literals, respectively. - */ - numbers?: "binary" | "octal" | "decimal" | "hexadecimal" | undefined; - /** - * The wrap option takes a boolean value (true or false), and defaults to false (disabled). When enabled, the - * output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through - * the quotes setting. - */ - wrap?: boolean | undefined; - /** - * The es6 option takes a boolean value (true or false), and defaults to false (disabled). When enabled, any - * astral Unicode symbols in the input are escaped using ECMAScript 6 Unicode code point escape sequences - * instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 - * environments is a concern, don’t enable this setting. If the json setting is enabled, the value for the es6 - * setting is ignored (as if it was false). - */ - es6?: boolean | undefined; - /** - * The escapeEverything option takes a boolean value (true or false), and defaults to false (disabled). When - * enabled, all the symbols in the output are escaped — even printable ASCII symbols. - */ - escapeEverything?: boolean | undefined; - /** - * The minimal option takes a boolean value (true or false), and defaults to false (disabled). When enabled, - * only a limited set of symbols in the output are escaped: \0, \b, \t, \n, \f, \r, \\, \u2028, \u2029. - */ - minimal?: boolean | undefined; - /** - * The isScriptContext option takes a boolean value (true or false), and defaults to false (disabled). When - * enabled, occurrences of or or