Package com.vaadin.flow.server.frontend
Class BundleValidationUtil
java.lang.Object
com.vaadin.flow.server.frontend.BundleValidationUtil
Bundle handling methods.
For internal use only. May be renamed or removed in a future release.
- Since:
- 24.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcalculateHash(String fileContent) static booleanexportedWebComponents(tools.jackson.databind.JsonNode statsJson, ClassFinder finder) static booleanfrontendImportsFound(tools.jackson.databind.JsonNode statsJson, Options options, FrontendDependenciesScanner frontendDependencies) static tools.jackson.databind.JsonNodegetDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, tools.jackson.databind.node.ObjectNode packageJson) static tools.jackson.databind.JsonNodegetPackageJson(Options options, FrontendDependenciesScanner frontendDependencies) Get the package.json file from disk if available else generate in memory.static StringgetPackageJsonHash(tools.jackson.databind.JsonNode packageJson) static URLgetProdBundleResource(String filename, ClassFinder finder) static StringgetStatsHash(tools.jackson.databind.JsonNode statsJson) static booleanhashAndBundleModulesEqual(tools.jackson.databind.JsonNode statsJson, tools.jackson.databind.JsonNode packageJson, Map<String, String> npmPackages) Verify that package hash versions are equal and that all project npmPackages are in bundle.static booleanhasJarBundle(String jarPath, ClassFinder finder) Check if jar bundle exists on given path.static voidlogChangedFiles(List<String> frontendFiles, String message) static booleanneedsBuild(Options options, FrontendDependenciesScanner frontendDependencies, Mode mode) Checks if an application needs a new frontend bundle.static booleanneedsBundleBuild(File resourceOutputFolder) Checks if a new production bundle is needed by restoring re-bundle checker result flag from a temporal file.
-
Constructor Details
-
BundleValidationUtil
public BundleValidationUtil()
-
-
Method Details
-
needsBuild
public static boolean needsBuild(Options options, FrontendDependenciesScanner frontendDependencies, Mode mode) Checks if an application needs a new frontend bundle.- Parameters:
options- Flow plugin optionsfrontendDependencies- frontend dependencies scanner to lookup for frontend importsmode- Vaadin application mode- Returns:
- true if a new frontend bundle is needed, false otherwise
-
hasJarBundle
Check if jar bundle exists on given path.- Parameters:
jarPath- JAR path where bunlde to check is locatedfinder- the class finder to use for locating resources- Returns:
trueif bundle stats.json is found
-
getPackageJson
public static tools.jackson.databind.JsonNode getPackageJson(Options options, FrontendDependenciesScanner frontendDependencies) Get the package.json file from disk if available else generate in memory.For the loaded file update versions as per in memory to get correct application versions.
- Parameters:
options- the task optionsfrontendDependencies- frontend dependency scanner- Returns:
- package.json content as JsonNode
-
getDefaultPackageJson
public static tools.jackson.databind.JsonNode getDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, tools.jackson.databind.node.ObjectNode packageJson) -
hashAndBundleModulesEqual
public static boolean hashAndBundleModulesEqual(tools.jackson.databind.JsonNode statsJson, tools.jackson.databind.JsonNode packageJson, Map<String, String> npmPackages) Verify that package hash versions are equal and that all project npmPackages are in bundle.- Parameters:
statsJson- devBundle statsJsonpackageJson- packageJsonnpmPackages- npm packages map- Returns:
trueif up to date
-
exportedWebComponents
public static boolean exportedWebComponents(tools.jackson.databind.JsonNode statsJson, ClassFinder finder) -
frontendImportsFound
public static boolean frontendImportsFound(tools.jackson.databind.JsonNode statsJson, Options options, FrontendDependenciesScanner frontendDependencies) throws IOException - Throws:
IOException
-
calculateHash
-
getStatsHash
-
getPackageJsonHash
-
logChangedFiles
-
getProdBundleResource
-
needsBundleBuild
Checks if a new production bundle is needed by restoring re-bundle checker result flag from a temporal file.- Parameters:
resourceOutputFolder- output directory for generated non-served resources- Returns:
- true if a new bundle is needed, false otherwise
-