com.vaadin.flow.server.frontend.
Class 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 String
calculateHash
(String fileContent) static boolean
exportedWebComponents
(com.fasterxml.jackson.databind.JsonNode statsJson, ClassFinder finder) static boolean
frontendImportsFound
(com.fasterxml.jackson.databind.JsonNode statsJson, Options options, FrontendDependenciesScanner frontendDependencies) static com.fasterxml.jackson.databind.JsonNode
getDefaultPackageJson
(Options options, FrontendDependenciesScanner frontendDependencies, com.fasterxml.jackson.databind.node.ObjectNode packageJson) static com.fasterxml.jackson.databind.JsonNode
getPackageJson
(Options options, FrontendDependenciesScanner frontendDependencies) Get the package.json file from disk if available else generate in memory.
static String
getPackageJsonHash
(com.fasterxml.jackson.databind.JsonNode packageJson) static URL
getProdBundleResource
(String filename, ClassFinder finder) static String
getStatsHash
(com.fasterxml.jackson.databind.JsonNode statsJson) static boolean
hashAndBundleModulesEqual
(com.fasterxml.jackson.databind.JsonNode statsJson, com.fasterxml.jackson.databind.JsonNode packageJson, Map<String, String> npmPackages) Verify that package hash versions are equal and that all project npmPackages are in bundle.
static boolean
hasJarBundle
(String jarPath, ClassFinder finder) Check if jar bundle exists on given path.
static void
logChangedFiles
(List<String> frontendFiles, String message) static boolean
needsBuild
(Options options, FrontendDependenciesScanner frontendDependencies, Mode mode) Checks if an application needs a new frontend bundle.
static boolean
needsBundleBuild
(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 modeReturns:
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 locatedReturns:
true
if bundle stats.json is found -
getPackageJson
public static com.fasterxml.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 scannerReturns:
package.json content as JsonNode
-
getDefaultPackageJson
public static com.fasterxml.jackson.databind.JsonNode getDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, com.fasterxml.jackson.databind.node.ObjectNode packageJson) -
hashAndBundleModulesEqual
public static boolean hashAndBundleModulesEqual(com.fasterxml.jackson.databind.JsonNode statsJson, com.fasterxml.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 mapReturns:
true
if up to date -
exportedWebComponents
public static boolean exportedWebComponents(com.fasterxml.jackson.databind.JsonNode statsJson, ClassFinder finder) -
frontendImportsFound
public static boolean frontendImportsFound(com.fasterxml.jackson.databind.JsonNode statsJson, Options options, FrontendDependenciesScanner frontendDependencies) throws IOException Throws:
-
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 resourcesReturns:
true if a new bundle is needed, false otherwise
-