[cc-3-8-x-mcp] 修复: 补全离线 CLI 解析路径与自包含夹具

改了什么:解析结果记录资源来源路径,并生成独立 Prefab、嵌套资源和脚本夹具。

为什么:测试依赖外部项目资源和临时目录时会导致嵌套解析与类 ID 结果不稳定。

影响范围:离线 CLI 解析、组件引用错误信息及 offline tools 测试。
This commit is contained in:
furao
2026-08-14 12:09:20 +08:00
parent 4fa698a757
commit a3b016ea8e
9 changed files with 251 additions and 21 deletions
+1 -1
View File
@@ -92,7 +92,7 @@ function execSetComponentRef(prefabData, op) {
const comp = findComponent(elements, node, componentType);
if (!comp) {
throw new Error(`editPrefab [set-component-ref]: 节点 "${node._name}" 未挂 "${componentType}" 组件`);
throw new Error(`editPrefab [set-component-ref]: 节点 "${node._name}" 未挂 "${rawComponentType}" 组件`);
}
const { node: refNode, nodeId: refNodeId } = resolveNode(prefabData, refNodeSelector, 'set-component-ref');
+3
View File
@@ -153,6 +153,9 @@ function parsePrefab(filePath) {
raw,
elements,
rootId,
// 解析结果可直接交给 overrides/nested helpers 使用;调用方不应再被迫
// 手工补一遍来源路径。editPrefab 仍可用 options.projectRoot 覆盖它。
resolverStartPath: filePath,
findNodeByName,
findNodesByType,
getRoot,