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(elemental.json.JsonObject statsJson, ClassFinder finder) static StringfindProdBundleStatsJson(ClassFinder finder) static booleanfrontendImportsFound(elemental.json.JsonObject statsJson, Options options, ClassFinder finder, FrontendDependenciesScanner frontendDependencies) static elemental.json.JsonObjectgetDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, ClassFinder finder, elemental.json.JsonObject packageJson) static elemental.json.JsonObjectgetPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, ClassFinder finder) Get the package.json file from disk if available else generate in memory.static StringgetPackageJsonHash(elemental.json.JsonObject packageJson) static URLgetProdBundleResource(String filename, ClassFinder finder) static StringgetStatsHash(elemental.json.JsonObject statsJson) static booleanhashAndBundleModulesEqual(elemental.json.JsonObject statsJson, elemental.json.JsonObject 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, ClassFinder finder, 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, ClassFinder finder, Mode mode) Checks if an application needs a new frontend bundle.- Parameters:
options- Flow plugin optionsfrontendDependencies- frontend dependencies scanner to lookup for frontend importsfinder- class finder to obtain classes and resources from class-pathmode- 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 located- Returns:
trueif bundle stats.json is found
-
getPackageJson
public static elemental.json.JsonObject getPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, ClassFinder finder) 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 scannerfinder- classfinder- Returns:
- package.json content as JsonObject
-
getDefaultPackageJson
public static elemental.json.JsonObject getDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, ClassFinder finder, elemental.json.JsonObject packageJson) -
hashAndBundleModulesEqual
public static boolean hashAndBundleModulesEqual(elemental.json.JsonObject statsJson, elemental.json.JsonObject 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(elemental.json.JsonObject statsJson, ClassFinder finder) -
frontendImportsFound
public static boolean frontendImportsFound(elemental.json.JsonObject statsJson, Options options, ClassFinder finder, FrontendDependenciesScanner frontendDependencies) throws IOException - Throws:
IOException
-
calculateHash
-
getStatsHash
-
getPackageJsonHash
-
logChangedFiles
-
findProdBundleStatsJson
- Throws:
IOException
-
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
-