Class GenerateMainImports
java.lang.Object
io.jmix.flowui.devserver.frontend.GenerateMainImports
- All Implemented Interfaces:
Runnable
Collect generated-flow-imports content for project to use to determine if
dev-bundle contains all required imports.
Only used when checking if dev bundle need to be rebuild in dev mode without a dev server.
-
Constructor Summary
ConstructorDescriptionGenerateMainImports
(com.vaadin.flow.server.frontend.scanner.ClassFinder classFinder, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDepScanner, Options options, com.vaadin.flow.theme.ThemeDefinition themeDefinition, elemental.json.JsonObject statsJson) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
addCssLines
(Collection<String> lines, com.vaadin.flow.server.frontend.scanner.CssData cssData, int i) Adds CSS imports to the generated flow imports file based on the given CssImport data.protected void
addLines
(Collection<String> lines, String content) protected Set<com.vaadin.flow.server.frontend.scanner.CssData>
getCss()
Get all the CSS files used by the application.protected Collection<String>
protected Collection<String>
Get exported modules.protected Collection<String>
Get generated modules to import.protected String
getLines()
protected org.slf4j.Logger
Get logger for this instance.Get all ES6 modules needed for run the application.protected URL
getResource
(String name) Get a resource from the classpath.Get all the JS files used by the application.protected com.vaadin.flow.theme.AbstractTheme
getTheme()
Get theAbstractTheme
instance used in the application.protected com.vaadin.flow.theme.ThemeDefinition
Get theThemeDefinition
of the application.protected String
protected Collection<String>
Get theme lines for the generated imports file content.protected boolean
importedFileExists
(String importName) Validate that the fileimportName
can be found.protected boolean
If in memory collection we are collecting for devBundle check.protected String
resolveResource
(String importPath) void
run()
protected void
updateImportsFile
(File importsFile, List<String> newContent) protected void
writeImportLines
(List<String> lines)
-
Constructor Details
-
GenerateMainImports
public GenerateMainImports(com.vaadin.flow.server.frontend.scanner.ClassFinder classFinder, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDepScanner, Options options, com.vaadin.flow.theme.ThemeDefinition themeDefinition, elemental.json.JsonObject statsJson)
-
-
Method Details
-
getLines
-
addCssLines
protected boolean addCssLines(Collection<String> lines, com.vaadin.flow.server.frontend.scanner.CssData cssData, int i) Adds CSS imports to the generated flow imports file based on the given CssImport data.- Parameters:
lines
- collection of generated file lines to add imports tocssData
- CssImport datai
- imported CSS counter- Returns:
- true if the imported CSS files does exist, false otherwise
-
writeImportLines
-
getModules
Get all ES6 modules needed for run the application. Modules that are theme dependencies are guaranteed to precede other modules in the result.- Returns:
- list of JS modules
-
getScripts
Get all the JS files used by the application.- Returns:
- the set of JS files
-
getResource
Get a resource from the classpath.- Parameters:
name
- class literal- Returns:
- the resource
-
getGeneratedModules
Get generated modules to import.- Returns:
- generated modules
-
getThemeDefinition
protected com.vaadin.flow.theme.ThemeDefinition getThemeDefinition()Get theThemeDefinition
of the application.- Returns:
- the theme definition
-
getTheme
protected com.vaadin.flow.theme.AbstractTheme getTheme()Get theAbstractTheme
instance used in the application.- Returns:
- the theme instance
-
getCss
Get all the CSS files used by the application.- Returns:
- the set of CSS files
-
getThemeLines
Get theme lines for the generated imports file content.- Returns:
- theme related generated JS lines
-
getLogger
protected org.slf4j.Logger getLogger()Get logger for this instance.- Returns:
- a logger
-
inMemoryCollection
protected boolean inMemoryCollection()If in memory collection we are collecting for devBundle check.- Returns:
true
if devBundle in memory collecting
-
getImportsNotFoundMessage
-
importedFileExists
Validate that the fileimportName
can be found.- Parameters:
importName
- name of the file- Returns:
true
if file is found
-
run
public void run() -
getExportLines
Get exported modules.- Returns:
- exported lines.
-
getCssLines
-
updateImportsFile
- Throws:
IOException
-
resolveResource
-
addLines
-
getThemeIdPrefix
-