From 41c1225620b11c95e8b3ea31fe5dc81fceb590db Mon Sep 17 00:00:00 2001 From: James Chen Date: Tue, 24 Sep 2024 10:47:55 +0800 Subject: [PATCH] Update version and api --- .api/public.d.ts | 17 +++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.api/public.d.ts b/.api/public.d.ts index 6aef176..afb8008 100644 --- a/.api/public.d.ts +++ b/.api/public.d.ts @@ -27,6 +27,22 @@ declare module "@cocos/ccbuild" { */ function enumerateAllDependents(meta: buildEngine.Result, featureUnits: string[]): string[]; export type ModuleFormat = "esm" | "cjs" | "system" | "iife"; + export type HasModuleSideEffects = (id: string, external: boolean) => boolean; + export type ModuleSideEffectsOption = boolean | "no-external" | string[] | HasModuleSideEffects; + export type TreeshakingPreset = "smallest" | "safest" | "recommended"; + export interface NormalizedTreeshakingOptions { + annotations: boolean; + correctVarValueBeforeDeclaration: boolean; + manualPureFunctions: readonly string[]; + moduleSideEffects: HasModuleSideEffects; + propertyReadSideEffects: boolean | "always"; + tryCatchDeoptimization: boolean; + unknownGlobalSideEffects: boolean; + } + export interface TreeshakingOptions extends Partial> { + moduleSideEffects?: ModuleSideEffectsOption; + preset?: TreeshakingPreset; + } export interface Options { /** * 引擎仓库目录。 @@ -162,6 +178,7 @@ declare module "@cocos/ccbuild" { * @note It's only avaiable when options.moduleFormat is 'system'. */ enableNamedRegisterForSystemJSModuleFormat?: boolean; + treeshake?: TreeshakingOptions; } export interface Result { /** diff --git a/package-lock.json b/package-lock.json index 69564bb..59b4a48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@cocos/ccbuild", - "version": "2.2.12", + "version": "2.2.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@cocos/ccbuild", - "version": "2.2.12", + "version": "2.2.13", "hasInstallScript": true, "license": "MIT", "workspaces": [ diff --git a/package.json b/package.json index 8fe5dac..aa7d7c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cocos/ccbuild", - "version": "2.2.12", + "version": "2.2.13", "description": "The next generation of build tool for Cocos engine.", "main": "./lib/index.js", "types": "./lib/index.d.ts",