-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v3.8.6] [TEST] Optimize code size, mangle protected properties. #18160
Draft
dumganhar
wants to merge
2
commits into
cocos:v3.8.6
Choose a base branch
from
dumganhar:386-test-mangle-protected-properties
base: v3.8.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
[v3.8.6] [TEST] Optimize code size, mangle protected properties. #18160
dumganhar
wants to merge
2
commits into
cocos:v3.8.6
from
dumganhar:386-test-mangle-protected-properties
+90
−55
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
👍 Package size ⤵ -89739 bytes, old: 5270176, new: 5180437Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -21293,8 +21293,9 @@
/**
* @internal
*/
_objFlags: number;
+ /** @dontmangle */
protected _name: string;
constructor(name?: string);
/**
* @en The name of the object.
@@ -24608,8 +24609,9 @@
/**
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_updateSiblingIndex(): void;
+ /** @dontmangle */
protected _instantiate(cloned?: Node | null, isSyncedNode?: boolean): Node;
protected _onHierarchyChangedBase(oldParent: this | null): void;
protected _onPreDestroyBase(): boolean;
protected _onSiblingIndexChanged?(siblingIndex: number): void;
@@ -25582,8 +25584,9 @@
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh 如果该组件启用,则每帧调用 update。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @param dt - the delta time in seconds it took to complete the last frame
+ * @dontmangle
*/
protected update?(dt: number): void;
/**
* @en LateUpdate is called every frame, if the Component is enabled.<br/>
@@ -25591,8 +25594,9 @@
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh 如果该组件启用,则每帧调用 LateUpdate。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @param dt - the delta time in seconds it took to complete the last frame
+ * @dontmangle
*/
protected lateUpdate?(dt: number): void;
/**
* @en `__preload` is called before every onLoad.<br/>
@@ -25603,8 +25607,9 @@
* 它用于在内部初始化内置组件,<br/>
* 以避免在每次公有方法调用之前检查是否调用了onLoad。<br/>
* 如果支持脚本优先级,则应删除此方法。
* @private
+ * @dontmangle
*/
protected __preload?(): void;
/**
* @en
@@ -25614,8 +25619,9 @@
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh
* 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
+ * @dontmangle
*/
protected onLoad?(): void;
/**
* @en
@@ -25625,32 +25631,36 @@
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh
* 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
+ * @dontmangle
*/
protected start?(): void;
/**
* @en Called when this component becomes enabled and its node is active.<br/>
* This is a lifecycle method. It may not be implemented in the super class.
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh 当该组件被启用,并且它的节点也激活时。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
+ * @dontmangle
*/
protected onEnable?(): void;
/**
* @en Called when this component becomes disabled or its node becomes inactive.<br/>
* This is a lifecycle method. It may not be implemented in the super class.
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh 当该组件被禁用或节点变为无效时调用。<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
+ * @dontmangle
*/
protected onDisable?(): void;
/**
* @en Called when this component will be destroyed.<br/>
* This is a lifecycle method. It may not be implemented in the super class.<br/>
* You can only call its super class method inside it. It should not be called manually elsewhere.
* @zh 当该组件被销毁时调用<br/>
* 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
+ * @dontmangle
*/
protected onDestroy?(): void;
onFocusInEditor?(): void;
onLostFocusInEditor?(): void;
@@ -25668,8 +25678,9 @@
* 如果组件的包围盒与节点不同,您可以实现该方法以提供自定义的轴向对齐的包围盒(AABB),
* 以便编辑器的场景视图可以正确地执行点选测试。
* @param out_rect - The rect to store the result bounding rect
* @private
+ * @dontmangle
*/
protected _getLocalBounds?(out_rect: math.Rect): void;
/**
* @en
@@ -25709,8 +25720,9 @@
* 一旦你实现这个方法,组件的所有 get set 都不会在重置操作时被调用。
* 这意味着仅仅指定了默认值的属性将被编辑器重置。
* <br/>
* 此方法仅在编辑器下会被调用。
+ * @dontmangle
*/
protected onRestore?(): void;
}
/**
@@ -25821,8 +25833,9 @@
* 此方法将在第一次实例化预制件之前自动调用,<br/>
* 但是您可以在脚本中修改原始预制数据后重新调用以刷新创建功能。
*/
compileCreateFunction(): void;
+ /** @dontmangle */
protected _instantiate(): Node;
initDefault(uuid?: string): void;
validate(): boolean;
onLoaded(): void;
@@ -64035,9 +64048,11 @@
*/
clear(): void;
protected searchKeyframe(time: number): number;
protected setKeyframes(times: number[], values: TKeyframeValue[]): void;
+ /** @dontmangle */
protected _times: number[];
+ /** @dontmangle */
protected _values: TKeyframeValue[];
}
/**
* @engineInternal
@@ -64337,9 +64352,9 @@
export class _cocos_core_event_callbacks_invoker__CallbacksInvoker<EventTypeClass extends _cocos_core_event_callbacks_invoker__EventType = _cocos_core_event_callbacks_invoker__EventType> {
/**
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
- _callbackTable: _cocos_core_event_callbacks_invoker__ICallbackTable;
+ protected _callbackTable: _cocos_core_event_callbacks_invoker__ICallbackTable;
/**
* @zh 向一个事件名注册一个新的事件监听器,包含回调函数和调用者
* @en Register an event listener to a given event key with callback and target.
*
@@ -64652,15 +64667,15 @@
* @deprecated since v3.4
*/
static markOpacityTree(node: any, isDirty?: boolean): void;
}
- function _cocos_scene_graph_component_scheduler__stableRemoveInactive(iterator: any, flagToClear: any): void;
- export type _cocos_scene_graph_component_scheduler__InvokeFunc = (...args: unknown[]) => void;
+ function _cocos_scene_graph_component_scheduler__stableRemoveInactive(iterator: js.array.MutableForwardIterator<Component>, flagToClear: number): void;
+ export type _cocos_scene_graph_component_scheduler__InvokeFunc = (iterator: js.array.MutableForwardIterator<Component>, dt?: number) => void;
export class _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
static stableRemoveInactive: typeof _cocos_scene_graph_component_scheduler__stableRemoveInactive;
- protected _zero: js.array.MutableForwardIterator<any>;
- protected _neg: js.array.MutableForwardIterator<any>;
- protected _pos: js.array.MutableForwardIterator<any>;
+ protected _zero: js.array.MutableForwardIterator<Component>;
+ protected _neg: js.array.MutableForwardIterator<Component>;
+ protected _pos: js.array.MutableForwardIterator<Component>;
protected _invoke: _cocos_scene_graph_component_scheduler__InvokeFunc;
constructor(invokeFunc: _cocos_scene_graph_component_scheduler__InvokeFunc);
}
export class _cocos_scene_graph_node_activator__UnsortedInvoker extends _cocos_scene_graph_component_scheduler__LifeCycleInvoker {
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: