(
node: Node,
rootId: debug.NodeID,
raw: debug.Mapped.Owner | undefined,
level: number,
)
| 213 | } |
| 214 | |
| 215 | function updateNode( |
| 216 | node: Node, |
| 217 | rootId: debug.NodeID, |
| 218 | raw: debug.Mapped.Owner | undefined, |
| 219 | level: number, |
| 220 | ): Node { |
| 221 | const {id, children} = node |
| 222 | NewNodeList.push(node) |
| 223 | node.level = level |
| 224 | |
| 225 | if (!raw) raw = Updated[rootId]?.[id] |
| 226 | |
| 227 | if (raw) { |
| 228 | // update frozen computations |
| 229 | if ('frozen' in raw && raw.frozen) node.frozen = true |
| 230 | |
| 231 | const {children: rawChildren} = raw |
| 232 | const newChildren: Node[] = (node.children = []) |
| 233 | |
| 234 | if (rawChildren.length) { |
| 235 | const prevChildrenMap: Record<debug.NodeID, Node> = {} |
| 236 | for (const child of children) prevChildrenMap[child.id] = child |
| 237 | |
| 238 | for (const childRaw of rawChildren) { |
| 239 | const childNode = prevChildrenMap[childRaw.id] |
| 240 | newChildren.push( |
| 241 | childNode |
| 242 | ? updateNode(childNode, rootId, childRaw, level + 1) |
| 243 | : createNode(childRaw, node, level + 1), |
| 244 | ) |
| 245 | } |
| 246 | } |
| 247 | } else { |
| 248 | for (const child of children) { |
| 249 | updateNode(child, rootId, Updated[rootId]?.[child.id], level + 1) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | return node |
| 254 | } |
| 255 | |
| 256 | export function reconcileStructure( |
| 257 | prevRoots: Node[], |
no test coverage detected
searching dependent graphs…