perf(apple): state each NIB object's class, label, and ID once (#1477)
The NIBArchive projection synthesizes customClass, label, and objectID so its records share the ibtool dictionary parser. The parser then returned those values as class_name, name, and the object ID, and the graph node kept the synthesized copies in attributes as well. Attributes now omit a key whose value its canonical field already carries; differing authored values stay. Transmission.app decode_interface_builder output shrinks from 6.45 MB to 6.14 MB. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2596f8da14
commit
5f6bb7a5ba
@@ -552,3 +552,32 @@ it("names the archive once per evidence record", () => {
|
||||
evidence.filter(({ description }) => description.includes(relativePath)),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("states each object's class, label, and ID once", () => {
|
||||
const { objects } = parseInterfaceBuilderRecords({
|
||||
"com.apple.ibtool.document.objects": {
|
||||
"7": {
|
||||
customClass: "NSButton",
|
||||
label: "Start",
|
||||
objectID: "7",
|
||||
nibValues: { NSContents: "Start" },
|
||||
},
|
||||
button: { class: "UIButton", title: "Build", objectID: "authored" },
|
||||
},
|
||||
});
|
||||
expect(objects).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "7",
|
||||
class_name: "NSButton",
|
||||
name: "Start",
|
||||
attributes: { nibValues: { NSContents: "Start" } },
|
||||
}),
|
||||
expect.objectContaining({
|
||||
id: "button",
|
||||
class_name: "UIButton",
|
||||
name: "Build",
|
||||
// Values that differ from the canonical fields stay as authored.
|
||||
attributes: { class: "UIButton", title: "Build", objectID: "authored" },
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user