-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Some updates to the Dev UI Signed-off-by: Phillip Kruger <[email protected]> * Use Scanned Web Dependencies and fix root path for assets * Add generated entrypoints and mixed static output * Fix quarkus version * fix entrypoints size --------- Signed-off-by: Phillip Kruger <[email protected]> Co-authored-by: Andy Damevin <[email protected]>
- Loading branch information
1 parent
f7c2fec
commit 5fb6f87
Showing
20 changed files
with
718 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,4 @@ pom.xml.tag | |
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
release.properties | ||
nbactions.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../main/java/io/quarkiverse/web/bundler/deployment/devui/DevUIWebDependenciesBuildItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkiverse.web.bundler.deployment.devui; | ||
|
||
import java.util.List; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
public final class DevUIWebDependenciesBuildItem extends SimpleBuildItem { | ||
private final List<DevUIWebDependency> webDependencies; | ||
|
||
public DevUIWebDependenciesBuildItem(List<DevUIWebDependency> webDependencies) { | ||
|
||
this.webDependencies = webDependencies; | ||
} | ||
|
||
public List<DevUIWebDependency> getWebDependencies() { | ||
return this.webDependencies; | ||
} | ||
|
||
record WebDependencyAsset(String name, | ||
List<WebDependencyAsset> children, | ||
boolean fileAsset, | ||
String urlPart) { | ||
} | ||
|
||
public record DevUIWebDependency(String type, | ||
String webDependencyName, | ||
String version, | ||
WebDependencyAsset rootAsset) { | ||
} | ||
} |
96 changes: 61 additions & 35 deletions
96
...t/src/main/java/io/quarkiverse/web/bundler/deployment/devui/WebBundlerDevUIProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,112 @@ | ||
package io.quarkiverse.web.bundler.deployment.devui; | ||
|
||
import static io.quarkiverse.web.bundler.deployment.devui.WebBundlerDevUIWebDependenciesProcessor.resolveFromRootPath; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
import io.quarkiverse.web.bundler.deployment.WebBundlerConfig; | ||
import io.quarkiverse.web.bundler.deployment.items.*; | ||
import io.quarkiverse.web.bundler.deployment.web.GeneratedWebResourceBuildItem; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.devui.spi.page.CardPageBuildItem; | ||
import io.quarkus.devui.spi.page.Page; | ||
import io.quarkus.vertx.http.runtime.HttpBuildTimeConfig; | ||
|
||
public class WebBundlerDevUIProcessor { | ||
|
||
@BuildStep(onlyIf = IsDevelopment.class) | ||
public void createPages(WebBundlerConfig config, | ||
HttpBuildTimeConfig httpConfig, | ||
BuildProducer<CardPageBuildItem> cardPageProducer, | ||
List<EntryPointBuildItem> entryPoints, | ||
List<GeneratedEntryPointBuildItem> generatedEntryPoints, | ||
WebDependenciesBuildItem webDependencies, | ||
StaticAssetsBuildItem staticAssets, | ||
QuteTemplatesBuildItem htmlAssets) { | ||
List<GeneratedWebResourceBuildItem> generatedWebResources, | ||
DevUIWebDependenciesBuildItem devUIWebDependencies) { | ||
|
||
CardPageBuildItem cardPageBuildItem = new CardPageBuildItem(); | ||
|
||
if (!webDependencies.isEmpty()) { | ||
cardPageBuildItem.addBuildTimeData("webDependencies", webDependencies.list()); | ||
cardPageBuildItem.addPage(Page.tableDataPageBuilder("Web Dependencies") | ||
.icon("font-awesome-solid:table") | ||
.showColumn("id") | ||
.showColumn("type") | ||
.showColumn("direct") | ||
.staticLabel(String.valueOf(webDependencies.list().size())) | ||
.buildTimeDataKey("webDependencies")); | ||
// Web Dependency Libraries | ||
cardPageBuildItem.addBuildTimeData("webDependencies", devUIWebDependencies.getWebDependencies()); | ||
|
||
cardPageBuildItem.addPage(Page.webComponentPageBuilder() | ||
.componentLink("qwc-web-bundler-web-dependencies.js") | ||
.title("Web Dependencies") | ||
.icon("font-awesome-brands:square-js") | ||
.staticLabel(String.valueOf(webDependencies.list().size()))); | ||
|
||
} | ||
final Map<String, EntryPointItem> generatedEntryPointsMap = generatedEntryPoints.stream() | ||
.collect( | ||
Collectors.toMap(GeneratedEntryPointBuildItem::key, | ||
e -> new EntryPointItem(e.webAsset().pathFromWebRoot(config.webRoot()), | ||
e.webAsset().type().label(), new String(e.webAsset().contentOrReadFromFile())), | ||
(a, b) -> b)); | ||
|
||
if (!entryPoints.isEmpty()) { | ||
final List<EntryPoint> entryPointsForDevUI = entryPoints.stream() | ||
.map(e -> new EntryPoint(e.getEntryPointKey(), getEntryPointItems(config, generatedEntryPointsMap, e))) | ||
.toList(); | ||
|
||
cardPageBuildItem.addBuildTimeData("entryPoints", | ||
entryPoints.stream().map(e -> new EntryPoint(e.getEntryPointKey(), e.getWebAssets().stream() | ||
.map(a -> new EntryPointItem(a.webAsset().pathFromWebRoot(config.webRoot()), a.type().label())) | ||
.toList())) | ||
.toList()); | ||
entryPointsForDevUI); | ||
|
||
cardPageBuildItem.addPage(Page.webComponentPageBuilder() | ||
.componentLink("qwc-web-bundler-entry-points.js") | ||
.title("Entry Points") | ||
.icon("font-awesome-solid:folder-tree") | ||
.staticLabel(String.valueOf(webDependencies.list().size()))); | ||
.staticLabel(String.valueOf(entryPointsForDevUI.size()))); | ||
|
||
} | ||
|
||
if (!htmlAssets.getWebAssets().isEmpty()) { | ||
cardPageBuildItem.addBuildTimeData("htmlAssets", htmlAssets.getWebAssets().stream() | ||
.map(s -> new WebAsset(s.pathFromWebRoot(config.webRoot()))).toList()); | ||
cardPageBuildItem.addPage(Page.tableDataPageBuilder("Html templates") | ||
.icon("font-awesome-solid:table") | ||
.showColumn("path") | ||
.staticLabel(String.valueOf(htmlAssets.getWebAssets().size())) | ||
.buildTimeDataKey("htmlAssets")); | ||
if (!generatedWebResources.isEmpty()) { | ||
final List<WebAsset> assets = generatedWebResources.stream() | ||
.sorted(Comparator.comparing(w -> w.type().order())) | ||
.map(w -> new WebAsset(resolveFromRootPath(httpConfig, w.publicPath()), w.type().label(), | ||
new String(w.content()))) | ||
|
||
} | ||
|
||
if (!staticAssets.getWebAssets().isEmpty()) { | ||
cardPageBuildItem.addBuildTimeData("staticAssets", staticAssets.getWebAssets().stream() | ||
.map(s -> new WebAsset(s.pathFromWebRoot(config.webRoot()))).toList()); | ||
cardPageBuildItem.addPage(Page.tableDataPageBuilder("Static Assets") | ||
.icon("font-awesome-solid:table") | ||
.showColumn("path") | ||
.staticLabel(String.valueOf(staticAssets.getWebAssets().size())) | ||
.buildTimeDataKey("staticAssets")); | ||
.toList(); | ||
|
||
cardPageBuildItem.addBuildTimeData("staticAssets", assets); | ||
cardPageBuildItem.addPage(Page.webComponentPageBuilder() | ||
.componentLink("qwc-web-bundler-output.js") | ||
.title("Static Output") | ||
.icon("font-awesome-solid:arrow-right-from-bracket") | ||
.staticLabel(String.valueOf(assets.size()))); | ||
} | ||
|
||
cardPageProducer.produce(cardPageBuildItem); | ||
} | ||
|
||
record WebAsset(String path) { | ||
private static List<EntryPointItem> getEntryPointItems(WebBundlerConfig config, | ||
Map<String, EntryPointItem> generatedEntryPoints, EntryPointBuildItem e) { | ||
final List<EntryPointItem> list = new ArrayList<>(); | ||
if (generatedEntryPoints.containsKey(e.getEntryPointKey())) { | ||
list.add(generatedEntryPoints.get(e.getEntryPointKey())); | ||
} | ||
list.addAll(e.getWebAssets().stream() | ||
.map(a -> new EntryPointItem( | ||
a.webAsset().pathFromWebRoot(config.webRoot()), | ||
a.type().label(), | ||
new String(a.webAsset().contentOrReadFromFile()))) | ||
.toList()); | ||
return list; | ||
} | ||
|
||
record WebAsset(String path, String type, String content) { | ||
} | ||
|
||
record EntryPoint(String key, List<EntryPointItem> items) { | ||
} | ||
|
||
record EntryPointItem(String path, String type) { | ||
record EntryPointItem(String path, String type, String content) { | ||
} | ||
|
||
} |
Oops, something went wrong.