Skip to content

Add queryNodeTree API and fix EditorExtends global aliasing#497

Merged
star-e merged 5 commits intococos:mainfrom
knoxHuang:task
Apr 21, 2026
Merged

Add queryNodeTree API and fix EditorExtends global aliasing#497
star-e merged 5 commits intococos:mainfrom
knoxHuang:task

Conversation

@knoxHuang
Copy link
Copy Markdown
Contributor

Summary

  • Add queryNodeTree method to INodeService for querying the scene hierarchy tree in the format used by the hierarchy panel
  • Move PrefabState enum to common/node.ts as a shared type and use it in IPrefabStateInfo instead of plain number
  • Change isCustomComponent from async to sync since it only performs a synchronous Set.has() check
  • Add alias-editor-extends-global rollup plugin to inject EditorExtends global after the editorExtends IIFE in scene bundle

Test plan

  • Verify queryNodeTree returns correct hierarchy for an opened scene
  • Verify queryNodeTree with path parameter returns the correct subtree
  • Verify isCustomComponent works correctly after async-to-sync change
  • Verify scene bundle builds successfully with the new rollup plugin
  • Verify EditorExtends is accessible in the built scene bundle

- Add queryNodeTree method to INodeService for querying the scene
  hierarchy tree in the format used by the hierarchy panel
- Move PrefabState enum to common/node.ts as a shared type and
  use it in IPrefabStateInfo instead of plain number
- Change isCustomComponent from async to sync since it only performs
  a synchronous Set.has() check
- Add alias-editor-extends-global rollup plugin to inject
  EditorExtends global after the editorExtends IIFE in scene bundle
…onPolicy

- Move PrefabState enum and IPrefabStateInfo interface from
  common/node.ts to common/prefab/prefab-info.ts where they belong
- Fix OptimizationPolicy enum: AUTO=0, SINGLE_INSTANCE=1, MULTI_INSTANCE=2
  (previously AUTO and SINGLE_INSTANCE were both 0)
- Update imports in prefab/utils.ts to use common re-export
Add test cases covering:
- Querying the full scene tree
- Verifying returned node fields (name, active, locked, type, etc.)
- Querying a subtree by path
- Querying a non-existent path returns null
- Component info includes type, isCustom, value, and extends
@knoxHuang knoxHuang removed the request for review from qiuguohua April 20, 2026 10:03
@star-e star-e merged commit bca93db into cocos:main Apr 21, 2026
4 checks passed
@knoxHuang knoxHuang deleted the task branch April 21, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants