Generated-code hygiene: listener cleanup, shared cn(), whitespace collapse, probe stripping, sub-pixel snapping, clone-origin metadata, dependency pinning
- DittoWire/Accordion/DropdownMenu runtime templates: AbortController-based listener cleanup, idempotent effects, orphan panel removal on unmount - Emit a single src/lib/utils.ts cn() instead of a copy per component file - Collapse captured whitespace runs under white-space:normal (pre* preserved) - Tag source-injected font-metric probe nodes at capture; drop them from IR - Snap sub-pixel arbitrary lengths (integer within 0.1px, else 1 decimal) - Emit SITE_ORIGIN (src/lib/site.ts, env-overridable): sitemap/robots/ canonical/og:url/JSON-LD resolve against the clone's own origin instead of the source domain - Pin lottie-web in generated package.json whenever DittoLottie is emitted 144 tests pass (21 new), typecheck clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
dfcd4a6563
commit
77be868ee3
@@ -98,3 +98,21 @@ describe("IR prune keeps <source> media candidates", () => {
|
||||
assert.equal(findByTag(root, "picture"), null);
|
||||
});
|
||||
});
|
||||
|
||||
describe("IR drops font-metric probe nodes (fix 4)", () => {
|
||||
it("excludes a walker-tagged probe node from the IR, keeping its siblings", () => {
|
||||
const probe: RawNode = {
|
||||
...raw("div", { class: "font-probe" }, [{ text: "Mgy" }]),
|
||||
probe: true,
|
||||
};
|
||||
const real = raw("h1", { class: "title" }, [{ text: "Heading" }]);
|
||||
const body = raw("body", {}, [real, probe]);
|
||||
|
||||
const root = buildFixtureIR(body);
|
||||
|
||||
const kept = root.children.filter((c) => !isTextChild(c)).map((c) => (c as IRNode).tag);
|
||||
assert.deepEqual(kept, ["h1"], "probe div is dropped, the real heading survives");
|
||||
// Its text must not leak into the tree either.
|
||||
assert.equal(findByTag(root, "div"), null);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user