Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions graphify/extractors/json_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
"app.json", "now.json", "vercel.json", "angular.json", "nest-cli.json",
"biome.json", "biome.jsonc", "renovate.json", ".babelrc", ".babelrc.json",
".eslintrc.json", ".prettierrc.json", ".prettierrc", "babel.config.json",
# The WordPress block manifest. It carries the nesting relationships that
# make a block graph worth having: parent, ancestor, allowedBlocks,
# providesContext / usesContext, and the editorScript / style handles. Only
# the blocks that happen to declare "$schema" reached the key probe, so a
# repo of blocks indexed as almost nothing.
"block.json",
})

_CONFIG_JSON_KEYS = frozenset({
Expand Down
23 changes: 23 additions & 0 deletions tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -4687,3 +4687,26 @@ def test_3252_metadata_preservation(tmp_path):
assert param_ref["source_location"] == "L2"
assert node_by_id[param_ref["target"]]["label"] == "User"
assert node_by_id[param_ref["target"]]["source_file"] == "models.py"


def test_extract_json_wordpress_block_manifest(tmp_path):
"""#3574: block.json is a manifest, not data JSON.

It was in neither the filename allowlist nor the key probe, so a block that
did not happen to declare "$schema" produced no nodes at all.
"""
block = tmp_path / "block.json"
block.write_text(
json.dumps(
{
"apiVersion": 3,
"name": "acme/card",
"title": "Card",
"parent": ["acme/deck"],
"editorScript": "file:./index.js",
}
)
)
result = extract_json(block)
assert len(result["nodes"]) > 0
assert "skipped" not in result
Loading