(tmp_path, with_css: bool)
| 452 | |
| 453 | |
| 454 | def _class_theme_graph(tmp_path, with_css: bool): |
| 455 | from graphify.build import build_from_json |
| 456 | from graphify.extract import extract |
| 457 | |
| 458 | root = tmp_path / ("with" if with_css else "without") |
| 459 | files = { |
| 460 | "layout/theme.liquid": "{{ content_for_layout }}\n", |
| 461 | "sections/main.liquid": "{% render 'card' %}\n<div class=\"btn\"></div>\n", |
| 462 | "snippets/card.liquid": "<a class=\"btn\"></a>\n{% stylesheet %}\n.card-x { color: red }\n{% endstylesheet %}\n", |
| 463 | "snippets/other.liquid": "<i class=\"btn card-x\"></i>\n", |
| 464 | } |
| 465 | if with_css: |
| 466 | files["assets/base.css"] = ".btn { color: red }\n" |
| 467 | for rel, text in files.items(): |
| 468 | p = root / rel |
| 469 | p.parent.mkdir(parents=True, exist_ok=True) |
| 470 | p.write_text(text, encoding="utf-8") |
| 471 | paths = sorted(p for p in root.rglob("*") if p.suffix in {".liquid", ".css"}) |
| 472 | return build_from_json(extract(paths, cache_root=root, root=root, parallel=False), directed=True) |
| 473 | |
| 474 | |
| 475 | def _affected_sources(graph, label: str) -> set[str]: |
no test coverage detected