@@ -132,7 +132,7 @@ public class BootstrapHandler extends SynchronizedRequestHandler {
132132 private static final String DEFER_ATTRIBUTE = "defer" ;
133133 static final String VIEWPORT = "viewport" ;
134134 private static final String META_TAG = "meta" ;
135- private static final String SCRIPT_TAG = "script" ;
135+ protected static final String SCRIPT_TAG = "script" ;
136136
137137 /**
138138 * Location of client nocache file, relative to the context root.
@@ -1595,15 +1595,14 @@ protected static void setupPwa(Document document, VaadinService service) {
15951595 setupPwa (document , service .getPwaRegistry ());
15961596 }
15971597
1598- protected static void addGeneratedIndexContent (
1599- DeploymentConfiguration config , Document targetDocument )
1598+ protected static JsonObject getStatsJson (DeploymentConfiguration config )
16001599 throws IOException {
16011600 String statsJson = DevBundleUtils
16021601 .findBundleStatsJson (config .getProjectFolder ());
16031602 Objects .requireNonNull (statsJson ,
16041603 "Frontend development bundle is expected to be in the project"
16051604 + " or on the classpath, but not found." );
1606- addGeneratedIndexContent ( targetDocument , Json .parse (statsJson ) );
1605+ return Json .parse (statsJson );
16071606 }
16081607
16091608 /**
@@ -1674,33 +1673,6 @@ private static Element getStyleTag(String themeName, String fileName,
16741673 return element ;
16751674 }
16761675
1677- private static void addGeneratedIndexContent (Document targetDocument ,
1678- JsonObject statsJson ) {
1679- JsonArray indexHtmlGeneratedRows = statsJson
1680- .getArray ("indexHtmlGenerated" );
1681- List <String > toAdd = new ArrayList <>();
1682-
1683- Optional <String > webComponentScript = JsonUtils
1684- .stream (statsJson .getArray ("entryScripts" ))
1685- .map (value -> value .asString ())
1686- .filter (script -> script .contains ("webcomponenthtml" ))
1687- .findFirst ();
1688-
1689- if (webComponentScript .isPresent ()) {
1690- Element elm = new Element (SCRIPT_TAG );
1691- elm .attr ("type" , "module" );
1692- elm .attr ("src" , webComponentScript .get ());
1693- toAdd .add (elm .outerHtml ());
1694- } else {
1695- toAdd .addAll (JsonUtils .stream (indexHtmlGeneratedRows )
1696- .map (value -> value .asString ()).toList ());
1697- }
1698-
1699- for (String row : toAdd ) {
1700- targetDocument .head ().append (row );
1701- }
1702- }
1703-
17041676 private static void setupPwa (Document document , PwaRegistry registry ) {
17051677 if (registry == null ) {
17061678 return ;
0 commit comments