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
(elemental.json.JsonObject statsJson, ClassFinder finder) static boolean
frontendImportsFound
(elemental.json.JsonObject statsJson, Options options, FrontendDependenciesScanner frontendDependencies) static elemental.json.JsonObject
getDefaultPackageJson
(Options options, FrontendDependenciesScanner frontendDependencies, elemental.json.JsonObject packageJson) static elemental.json.JsonObject
getPackageJson
(Options options, FrontendDependenciesScanner frontendDependencies) Get the package.json file from disk if available else generate in memory.
static String
getPackageJsonHash
(elemental.json.JsonObject packageJson) static URL
getProdBundleResource
(String filename, ClassFinder finder) static String
getStatsHash
(elemental.json.JsonObject statsJson) 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.
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 elemental.json.JsonObject 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 JsonObject
-
getDefaultPackageJson
public static elemental.json.JsonObject getDefaultPackageJson(Options options, FrontendDependenciesScanner frontendDependencies, 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 mapReturns:
true
if 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, 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
-