Class BundleLitParser


  • public final class BundleLitParser
    extends Object
    Parse statistics data provided by webpack.

    For internal use only. May be renamed or removed in a future release.

    Since:
    Author:
    Vaadin Ltd
    See Also:
    LitTemplateParser
    • Method Detail

      • getHashFromStatistics

        public static String getHashFromStatistics​(String fileContents)
        Gets the hash from the string content of a webpack stats file. It uses regex to avoid parsing the entire string into a json object.
        Parameters:
        fileContents - the content of the stats file
        Returns:
        the hash
      • parseJsonStatistics

        public static elemental.json.JsonObject parseJsonStatistics​(String fileContents)
        Parses the content of the stats file to return a json object.
        Parameters:
        fileContents - the content of the stats file
        Returns:
        a JsonObject with the stats
      • getSourceFromStatistics

        public static String getSourceFromStatistics​(String fileName,
                                                     elemental.json.JsonObject statistics,
                                                     VaadinService service)
        Get a module source from the statistics Json file generated by webpack.
        Parameters:
        fileName - name of the file to get from the json
        statistics - statistics json as a JsonObject
        service - current VaadinService
        Returns:
        JsonObject for the file statistic
      • parseLitTemplateElement

        public static org.jsoup.nodes.Element parseLitTemplateElement​(String fileName,
                                                                      String source)
        Get the Lit template element for the given polymer template source.
        Parameters:
        fileName - name of the handled file
        source - source js to get template element from
        Returns:
        template element or {code null} if not found