feat(extensions): code-first frontend contributions (#38346)

This commit is contained in:
Michael S. Molina
2026-03-02 18:51:29 -03:00
committed by GitHub
parent 01d5245cd2
commit a74d32ab44
56 changed files with 1430 additions and 2403 deletions

View File

@@ -59,20 +59,6 @@ def extension_with_build_structure():
"permissions": [],
}
if include_frontend:
extension_json["frontend"] = {
"contributions": {
"commands": [],
"views": {},
"menus": {},
"editors": [],
},
"moduleFederation": {
"exposes": ["./index"],
"name": "testOrg_testExtension",
},
}
if include_backend:
extension_json["backend"] = {
"entryPoints": [
@@ -249,18 +235,6 @@ def test_build_manifest_creates_correct_manifest_structure(isolated_filesystem):
"version": "1.0.0",
"permissions": ["read_data"],
"dependencies": ["some_dep"],
"frontend": {
"contributions": {
"commands": [{"id": "test_command", "title": "Test"}],
"views": {},
"menus": {},
"editors": [],
},
"moduleFederation": {
"exposes": ["./index"],
"name": "testOrg_testExtension",
},
},
"backend": {
"entryPoints": ["superset_extensions.test_org.test_extension.entrypoint"]
},
@@ -281,11 +255,8 @@ def test_build_manifest_creates_correct_manifest_structure(isolated_filesystem):
# Verify frontend section
assert manifest.frontend is not None
assert manifest.frontend.contributions.commands == [
{"id": "test_command", "title": "Test"}
]
assert manifest.frontend.moduleFederation.exposes == ["./index"]
assert manifest.frontend.remoteEntry == "remoteEntry.abc123.js"
assert manifest.frontend.moduleFederationName == "testOrg_testExtension"
# Verify backend section
assert manifest.backend is not None

View File

@@ -223,21 +223,8 @@ def test_extension_json_content_is_correct(
# Load and verify more complex nested structures
content = load_json_file(extension_json_path)
# Verify frontend section exists and has correct structure
assert "frontend" in content
frontend = content["frontend"]
assert "contributions" in frontend
assert "moduleFederation" in frontend
assert frontend["contributions"] == {
"commands": [],
"views": {},
"menus": {},
"editors": [],
}
assert frontend["moduleFederation"] == {
"exposes": ["./index"],
"name": "testOrg_testExtension",
}
# Verify frontend section is not present (contributions are code-first)
assert "frontend" not in content
# Verify backend section exists and has correct structure
assert "backend" in content

View File

@@ -78,21 +78,8 @@ def test_extension_json_template_renders_with_both_frontend_and_backend(
assert parsed["license"] == "Apache-2.0"
assert parsed["permissions"] == []
# Verify frontend section exists
assert "frontend" in parsed
frontend = parsed["frontend"]
assert "contributions" in frontend
assert "moduleFederation" in frontend
assert frontend["contributions"] == {
"commands": [],
"views": {},
"menus": {},
"editors": [],
}
assert frontend["moduleFederation"] == {
"exposes": ["./index"],
"name": "testOrg_testExtension",
}
# Verify frontend section is not present (contributions are code-first)
assert "frontend" not in parsed
# Verify backend section exists
assert "backend" in parsed
@@ -109,7 +96,7 @@ def test_extension_json_template_renders_with_both_frontend_and_backend(
@pytest.mark.parametrize(
"include_frontend,include_backend,expected_sections",
[
(True, False, ["frontend"]),
(True, False, []),
(False, True, ["backend"]),
(False, False, []),
],