mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
Update Hilla to 24.6.0
Fix plugin loading due to unavailable status from DB
This commit is contained in:
Generated
+4982
-15166
File diff suppressed because it is too large
Load Diff
+59
-59
@@ -7,22 +7,22 @@
|
|||||||
"@nextui-org/react": "^2.4.8",
|
"@nextui-org/react": "^2.4.8",
|
||||||
"@phosphor-icons/react": "^2.1.7",
|
"@phosphor-icons/react": "^2.1.7",
|
||||||
"@polymer/polymer": "3.5.2",
|
"@polymer/polymer": "3.5.2",
|
||||||
"@vaadin/bundles": "24.5.4",
|
"@vaadin/bundles": "24.6.0",
|
||||||
"@vaadin/common-frontend": "0.0.19",
|
"@vaadin/common-frontend": "0.0.19",
|
||||||
"@vaadin/hilla-file-router": "24.5.7",
|
"@vaadin/hilla-file-router": "24.6.0",
|
||||||
"@vaadin/hilla-frontend": "24.5.7",
|
"@vaadin/hilla-frontend": "24.6.0",
|
||||||
"@vaadin/hilla-lit-form": "24.5.7",
|
"@vaadin/hilla-lit-form": "24.6.0",
|
||||||
"@vaadin/hilla-react-auth": "24.5.7",
|
"@vaadin/hilla-react-auth": "24.6.0",
|
||||||
"@vaadin/hilla-react-crud": "24.5.7",
|
"@vaadin/hilla-react-crud": "24.6.0",
|
||||||
"@vaadin/hilla-react-form": "24.5.7",
|
"@vaadin/hilla-react-form": "24.6.0",
|
||||||
"@vaadin/hilla-react-i18n": "24.5.7",
|
"@vaadin/hilla-react-i18n": "24.6.0",
|
||||||
"@vaadin/hilla-react-signals": "24.5.7",
|
"@vaadin/hilla-react-signals": "24.6.0",
|
||||||
"@vaadin/polymer-legacy-adapter": "24.5.4",
|
"@vaadin/polymer-legacy-adapter": "24.6.0",
|
||||||
"@vaadin/react-components": "24.5.4",
|
"@vaadin/react-components": "24.6.0",
|
||||||
"@vaadin/vaadin-development-mode-detector": "2.0.7",
|
"@vaadin/vaadin-development-mode-detector": "2.0.7",
|
||||||
"@vaadin/vaadin-lumo-styles": "24.5.4",
|
"@vaadin/vaadin-lumo-styles": "24.6.0",
|
||||||
"@vaadin/vaadin-material-styles": "24.5.4",
|
"@vaadin/vaadin-material-styles": "24.6.0",
|
||||||
"@vaadin/vaadin-themable-mixin": "24.5.4",
|
"@vaadin/vaadin-themable-mixin": "24.6.0",
|
||||||
"@vaadin/vaadin-usage-statistics": "2.1.3",
|
"@vaadin/vaadin-usage-statistics": "2.1.3",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"classnames": "^2.5.1",
|
"classnames": "^2.5.1",
|
||||||
@@ -46,25 +46,25 @@
|
|||||||
"yup": "^1.4.0"
|
"yup": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-react": "7.25.9",
|
"@babel/preset-react": "7.26.3",
|
||||||
"@lit-labs/react": "^2.1.3",
|
"@lit-labs/react": "^2.1.3",
|
||||||
"@preact/signals-react-transform": "0.4.0",
|
"@preact/signals-react-transform": "0.4.0",
|
||||||
"@rollup/plugin-replace": "6.0.1",
|
"@rollup/plugin-replace": "6.0.1",
|
||||||
"@rollup/pluginutils": "5.1.3",
|
"@rollup/pluginutils": "5.1.3",
|
||||||
"@types/node": "^22.4.0",
|
"@types/node": "^22.4.0",
|
||||||
"@types/react": "18.3.12",
|
"@types/react": "18.3.13",
|
||||||
"@types/react-dom": "18.3.1",
|
"@types/react-dom": "18.3.1",
|
||||||
"@vaadin/hilla-generator-cli": "24.5.7",
|
"@vaadin/hilla-generator-cli": "24.6.0",
|
||||||
"@vaadin/hilla-generator-core": "24.5.7",
|
"@vaadin/hilla-generator-core": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-backbone": "24.5.7",
|
"@vaadin/hilla-generator-plugin-backbone": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-barrel": "24.5.7",
|
"@vaadin/hilla-generator-plugin-barrel": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-client": "24.5.7",
|
"@vaadin/hilla-generator-plugin-client": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-model": "24.5.7",
|
"@vaadin/hilla-generator-plugin-model": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-push": "24.5.7",
|
"@vaadin/hilla-generator-plugin-push": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-signals": "24.5.7",
|
"@vaadin/hilla-generator-plugin-signals": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-subtypes": "24.5.7",
|
"@vaadin/hilla-generator-plugin-subtypes": "24.6.0",
|
||||||
"@vaadin/hilla-generator-utils": "24.5.7",
|
"@vaadin/hilla-generator-utils": "24.6.0",
|
||||||
"@vitejs/plugin-react": "4.3.3",
|
"@vitejs/plugin-react": "4.3.4",
|
||||||
"@vitejs/plugin-react-swc": "^3.7.0",
|
"@vitejs/plugin-react-swc": "^3.7.0",
|
||||||
"async": "3.2.6",
|
"async": "3.2.6",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
@@ -76,8 +76,8 @@
|
|||||||
"strip-css-comments": "5.0.0",
|
"strip-css-comments": "5.0.0",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.10",
|
||||||
"transform-ast": "2.4.4",
|
"transform-ast": "2.4.4",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.7.2",
|
||||||
"vite": "5.4.11",
|
"vite": "6.0.3",
|
||||||
"vite-plugin-checker": "0.8.0",
|
"vite-plugin-checker": "0.8.0",
|
||||||
"workbox-build": "7.3.0",
|
"workbox-build": "7.3.0",
|
||||||
"workbox-core": "7.3.0",
|
"workbox-core": "7.3.0",
|
||||||
@@ -129,22 +129,22 @@
|
|||||||
"vaadin": {
|
"vaadin": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@polymer/polymer": "3.5.2",
|
"@polymer/polymer": "3.5.2",
|
||||||
"@vaadin/bundles": "24.5.4",
|
"@vaadin/bundles": "24.6.0",
|
||||||
"@vaadin/common-frontend": "0.0.19",
|
"@vaadin/common-frontend": "0.0.19",
|
||||||
"@vaadin/hilla-file-router": "24.5.7",
|
"@vaadin/hilla-file-router": "24.6.0",
|
||||||
"@vaadin/hilla-frontend": "24.5.7",
|
"@vaadin/hilla-frontend": "24.6.0",
|
||||||
"@vaadin/hilla-lit-form": "24.5.7",
|
"@vaadin/hilla-lit-form": "24.6.0",
|
||||||
"@vaadin/hilla-react-auth": "24.5.7",
|
"@vaadin/hilla-react-auth": "24.6.0",
|
||||||
"@vaadin/hilla-react-crud": "24.5.7",
|
"@vaadin/hilla-react-crud": "24.6.0",
|
||||||
"@vaadin/hilla-react-form": "24.5.7",
|
"@vaadin/hilla-react-form": "24.6.0",
|
||||||
"@vaadin/hilla-react-i18n": "24.5.7",
|
"@vaadin/hilla-react-i18n": "24.6.0",
|
||||||
"@vaadin/hilla-react-signals": "24.5.7",
|
"@vaadin/hilla-react-signals": "24.6.0",
|
||||||
"@vaadin/polymer-legacy-adapter": "24.5.4",
|
"@vaadin/polymer-legacy-adapter": "24.6.0",
|
||||||
"@vaadin/react-components": "24.5.4",
|
"@vaadin/react-components": "24.6.0",
|
||||||
"@vaadin/vaadin-development-mode-detector": "2.0.7",
|
"@vaadin/vaadin-development-mode-detector": "2.0.7",
|
||||||
"@vaadin/vaadin-lumo-styles": "24.5.4",
|
"@vaadin/vaadin-lumo-styles": "24.6.0",
|
||||||
"@vaadin/vaadin-material-styles": "24.5.4",
|
"@vaadin/vaadin-material-styles": "24.6.0",
|
||||||
"@vaadin/vaadin-themable-mixin": "24.5.4",
|
"@vaadin/vaadin-themable-mixin": "24.6.0",
|
||||||
"@vaadin/vaadin-usage-statistics": "2.1.3",
|
"@vaadin/vaadin-usage-statistics": "2.1.3",
|
||||||
"construct-style-sheets-polyfill": "3.1.0",
|
"construct-style-sheets-polyfill": "3.1.0",
|
||||||
"date-fns": "2.29.3",
|
"date-fns": "2.29.3",
|
||||||
@@ -154,36 +154,36 @@
|
|||||||
"react-router-dom": "6.28.0"
|
"react-router-dom": "6.28.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-react": "7.25.9",
|
"@babel/preset-react": "7.26.3",
|
||||||
"@preact/signals-react-transform": "0.4.0",
|
"@preact/signals-react-transform": "0.4.0",
|
||||||
"@rollup/plugin-replace": "6.0.1",
|
"@rollup/plugin-replace": "6.0.1",
|
||||||
"@rollup/pluginutils": "5.1.3",
|
"@rollup/pluginutils": "5.1.3",
|
||||||
"@types/react": "18.3.12",
|
"@types/react": "18.3.13",
|
||||||
"@types/react-dom": "18.3.1",
|
"@types/react-dom": "18.3.1",
|
||||||
"@vaadin/hilla-generator-cli": "24.5.7",
|
"@vaadin/hilla-generator-cli": "24.6.0",
|
||||||
"@vaadin/hilla-generator-core": "24.5.7",
|
"@vaadin/hilla-generator-core": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-backbone": "24.5.7",
|
"@vaadin/hilla-generator-plugin-backbone": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-barrel": "24.5.7",
|
"@vaadin/hilla-generator-plugin-barrel": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-client": "24.5.7",
|
"@vaadin/hilla-generator-plugin-client": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-model": "24.5.7",
|
"@vaadin/hilla-generator-plugin-model": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-push": "24.5.7",
|
"@vaadin/hilla-generator-plugin-push": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-signals": "24.5.7",
|
"@vaadin/hilla-generator-plugin-signals": "24.6.0",
|
||||||
"@vaadin/hilla-generator-plugin-subtypes": "24.5.7",
|
"@vaadin/hilla-generator-plugin-subtypes": "24.6.0",
|
||||||
"@vaadin/hilla-generator-utils": "24.5.7",
|
"@vaadin/hilla-generator-utils": "24.6.0",
|
||||||
"@vitejs/plugin-react": "4.3.3",
|
"@vitejs/plugin-react": "4.3.4",
|
||||||
"async": "3.2.6",
|
"async": "3.2.6",
|
||||||
"glob": "10.4.5",
|
"glob": "10.4.5",
|
||||||
"rollup-plugin-brotli": "3.1.0",
|
"rollup-plugin-brotli": "3.1.0",
|
||||||
"rollup-plugin-visualizer": "5.12.0",
|
"rollup-plugin-visualizer": "5.12.0",
|
||||||
"strip-css-comments": "5.0.0",
|
"strip-css-comments": "5.0.0",
|
||||||
"transform-ast": "2.4.4",
|
"transform-ast": "2.4.4",
|
||||||
"typescript": "5.6.3",
|
"typescript": "5.7.2",
|
||||||
"vite": "5.4.11",
|
"vite": "6.0.3",
|
||||||
"vite-plugin-checker": "0.8.0",
|
"vite-plugin-checker": "0.8.0",
|
||||||
"workbox-build": "7.3.0",
|
"workbox-build": "7.3.0",
|
||||||
"workbox-core": "7.3.0",
|
"workbox-core": "7.3.0",
|
||||||
"workbox-precaching": "7.3.0"
|
"workbox-precaching": "7.3.0"
|
||||||
},
|
},
|
||||||
"hash": "4bfcc93f77c9246e23c238a651d9282f58f2f417d16fae4df4b60df598bc7d16"
|
"hash": "accdc7fd578da56f35cba8d898b3776ad5594f3086365a42cccc9e7a0283251d"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package de.grimsi.gameyfin.core
|
package de.grimsi.gameyfin.core
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator
|
||||||
import com.fasterxml.jackson.annotation.JsonValue
|
import com.fasterxml.jackson.annotation.JsonValue
|
||||||
import de.grimsi.gameyfin.users.RoleService.Companion.INTERNAL_ROLE_PREFIX
|
import de.grimsi.gameyfin.users.RoleService.Companion.INTERNAL_ROLE_PREFIX
|
||||||
|
|
||||||
@@ -15,6 +16,14 @@ enum class Role(val roleName: String, val powerLevel: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
@JvmStatic
|
||||||
|
fun fromValue(value: String): Role? {
|
||||||
|
val enumString = value.removePrefix(INTERNAL_ROLE_PREFIX)
|
||||||
|
return Role.entries.find { it.roleName == enumString }
|
||||||
|
}
|
||||||
|
|
||||||
fun safeValueOf(type: String): Role? {
|
fun safeValueOf(type: String): Role? {
|
||||||
val enumString = type.removePrefix(INTERNAL_ROLE_PREFIX)
|
val enumString = type.removePrefix(INTERNAL_ROLE_PREFIX)
|
||||||
return java.lang.Enum.valueOf(Role::class.java, enumString)
|
return java.lang.Enum.valueOf(Role::class.java, enumString)
|
||||||
|
|||||||
+11
-58
@@ -3,69 +3,26 @@ package de.grimsi.gameyfin.core.plugins.management
|
|||||||
import de.grimsi.gameyfin.core.plugins.config.PluginConfigRepository
|
import de.grimsi.gameyfin.core.plugins.config.PluginConfigRepository
|
||||||
import de.grimsi.gameyfin.pluginapi.core.GameyfinPlugin
|
import de.grimsi.gameyfin.pluginapi.core.GameyfinPlugin
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.pf4j.AbstractPluginManager
|
import org.pf4j.*
|
||||||
import org.pf4j.CompoundPluginDescriptorFinder
|
|
||||||
import org.pf4j.CompoundPluginLoader
|
|
||||||
import org.pf4j.CompoundPluginRepository
|
|
||||||
import org.pf4j.DefaultExtensionFactory
|
|
||||||
import org.pf4j.DefaultExtensionFinder
|
|
||||||
import org.pf4j.DefaultPluginFactory
|
|
||||||
import org.pf4j.DefaultPluginLoader
|
|
||||||
import org.pf4j.DefaultPluginRepository
|
|
||||||
import org.pf4j.DefaultVersionManager
|
|
||||||
import org.pf4j.DevelopmentPluginRepository
|
|
||||||
import org.pf4j.ExtensionFactory
|
|
||||||
import org.pf4j.ExtensionFinder
|
|
||||||
import org.pf4j.JarPluginLoader
|
|
||||||
import org.pf4j.JarPluginRepository
|
|
||||||
import org.pf4j.ManifestPluginDescriptorFinder
|
|
||||||
import org.pf4j.PluginDescriptorFinder
|
|
||||||
import org.pf4j.PluginFactory
|
|
||||||
import org.pf4j.PluginLoader
|
|
||||||
import org.pf4j.PluginRepository
|
|
||||||
import org.pf4j.PluginStatusProvider
|
|
||||||
import org.pf4j.PluginWrapper
|
|
||||||
import org.pf4j.PropertiesPluginDescriptorFinder
|
|
||||||
import org.pf4j.VersionManager
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
|
import kotlin.io.path.Path
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see https://stackoverflow.com/questions/73654174/my-application-cant-find-the-extension-with-pf4j
|
* @see https://stackoverflow.com/questions/73654174/my-application-cant-find-the-extension-with-pf4j
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
class GameyfinPluginManager(
|
class GameyfinPluginManager(
|
||||||
private val pluginConfigRepository: PluginConfigRepository,
|
val pluginConfigRepository: PluginConfigRepository,
|
||||||
private val pluginStatusProvider: DatabasePluginStatusProvider
|
val dbPluginStatusProvider: DatabasePluginStatusProvider
|
||||||
) : AbstractPluginManager() {
|
) : DefaultPluginManager(Path(System.getProperty("pf4j.pluginsDir", "plugins"))) {
|
||||||
|
|
||||||
private val log = KotlinLogging.logger {}
|
private val log = KotlinLogging.logger {}
|
||||||
|
|
||||||
override fun createPluginRepository(): PluginRepository {
|
// This took me way too long to figure out...
|
||||||
return CompoundPluginRepository()
|
// But I learned a lot about Kotlin and Java interoperability in the process
|
||||||
.add(DevelopmentPluginRepository(pluginsRoots), this::isDevelopment)
|
init {
|
||||||
.add(JarPluginRepository(pluginsRoots), this::isNotDevelopment)
|
this.pluginStatusProvider = dbPluginStatusProvider
|
||||||
.add(DefaultPluginRepository(pluginsRoots), this::isNotDevelopment)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPluginFactory(): PluginFactory {
|
|
||||||
return DefaultPluginFactory()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createExtensionFactory(): ExtensionFactory {
|
|
||||||
return DefaultExtensionFactory()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPluginDescriptorFinder(): PluginDescriptorFinder {
|
|
||||||
return CompoundPluginDescriptorFinder()
|
|
||||||
.add(PropertiesPluginDescriptorFinder())
|
|
||||||
.add(ManifestPluginDescriptorFinder())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createExtensionFinder(): ExtensionFinder {
|
|
||||||
val extensionFinder = DefaultExtensionFinder(this)
|
|
||||||
addPluginStateListener(extensionFinder)
|
|
||||||
return extensionFinder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createPluginLoader(): PluginLoader {
|
override fun createPluginLoader(): PluginLoader {
|
||||||
@@ -80,12 +37,8 @@ class GameyfinPluginManager(
|
|||||||
.add(defaultPluginLoader, this::isNotDevelopment)
|
.add(defaultPluginLoader, this::isNotDevelopment)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createVersionManager(): VersionManager? {
|
|
||||||
return DefaultVersionManager()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createPluginStatusProvider(): PluginStatusProvider {
|
override fun createPluginStatusProvider(): PluginStatusProvider {
|
||||||
return pluginStatusProvider
|
return dbPluginStatusProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadPluginFromPath(pluginPath: Path?): PluginWrapper? {
|
override fun loadPluginFromPath(pluginPath: Path?): PluginWrapper? {
|
||||||
@@ -115,6 +68,6 @@ class GameyfinPluginManager(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getConfig(pluginId: String): Map<String, String?> {
|
private fun getConfig(pluginId: String): Map<String, String?> {
|
||||||
return pluginConfigRepository.findAllById_PluginId(pluginId).map { it.id.key to it.value }.toMap()
|
return pluginConfigRepository.findAllById_PluginId(pluginId).associate { it.id.key to it.value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-14
@@ -1,26 +1,20 @@
|
|||||||
package de.grimsi.gameyfin.core.plugins.management
|
package de.grimsi.gameyfin.core.plugins.management
|
||||||
|
|
||||||
import de.grimsi.gameyfin.core.plugins.config.PluginConfigRepository
|
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.boot.context.event.ApplicationReadyEvent
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.event.EventListener
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
class PluginManagerConfig(
|
class PluginManagerConfig(
|
||||||
private val pluginConfigRepository: PluginConfigRepository,
|
private val pluginManager: GameyfinPluginManager
|
||||||
private val dbPluginStatusProvider: DatabasePluginStatusProvider
|
|
||||||
) {
|
) {
|
||||||
private val log = KotlinLogging.logger {}
|
private val log = KotlinLogging.logger {}
|
||||||
|
|
||||||
@Bean
|
@EventListener(ApplicationReadyEvent::class)
|
||||||
fun gameyfinPluginManager(): GameyfinPluginManager {
|
|
||||||
return GameyfinPluginManager(pluginConfigRepository, dbPluginStatusProvider)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@EventListener(ApplicationReadyEvent::class)
|
|
||||||
fun loadPlugins() {
|
fun loadPlugins() {
|
||||||
gameyfinPluginManager().loadPlugins()
|
pluginManager.loadPlugins()
|
||||||
gameyfinPluginManager().startPlugins()
|
pluginManager.startPlugins()
|
||||||
log.info { "Loaded plugins: ${gameyfinPluginManager().plugins.map { it.pluginId }}" }
|
log.info { "Loaded plugins: ${pluginManager.plugins.map { it.pluginId }}" }
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
+21
-16
@@ -5,7 +5,7 @@
|
|||||||
* This file will be overwritten on every run. Any custom changes should be made to vite.config.ts
|
* This file will be overwritten on every run. Any custom changes should be made to vite.config.ts
|
||||||
*/
|
*/
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'fs';
|
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, Stats } from 'fs';
|
||||||
import { createHash } from 'crypto';
|
import { createHash } from 'crypto';
|
||||||
import * as net from 'net';
|
import * as net from 'net';
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
ResolvedConfig,
|
ResolvedConfig,
|
||||||
UserConfigFn
|
UserConfigFn
|
||||||
} from 'vite';
|
} from 'vite';
|
||||||
import { getManifest } from 'workbox-build';
|
import { getManifest, type ManifestTransform } from 'workbox-build';
|
||||||
|
|
||||||
import * as rollup from 'rollup';
|
import * as rollup from 'rollup';
|
||||||
import brotli from 'rollup-plugin-brotli';
|
import brotli from 'rollup-plugin-brotli';
|
||||||
@@ -90,7 +90,7 @@ console.trace = () => {};
|
|||||||
console.debug = () => {};
|
console.debug = () => {};
|
||||||
|
|
||||||
function injectManifestToSWPlugin(): rollup.Plugin {
|
function injectManifestToSWPlugin(): rollup.Plugin {
|
||||||
const rewriteManifestIndexHtmlUrl = (manifest) => {
|
const rewriteManifestIndexHtmlUrl: ManifestTransform = (manifest) => {
|
||||||
const indexEntry = manifest.find((entry) => entry.url === 'index.html');
|
const indexEntry = manifest.find((entry) => entry.url === 'index.html');
|
||||||
if (indexEntry) {
|
if (indexEntry) {
|
||||||
indexEntry.url = appShellUrl;
|
indexEntry.url = appShellUrl;
|
||||||
@@ -106,7 +106,7 @@ function injectManifestToSWPlugin(): rollup.Plugin {
|
|||||||
const { manifestEntries } = await getManifest({
|
const { manifestEntries } = await getManifest({
|
||||||
globDirectory: buildOutputFolder,
|
globDirectory: buildOutputFolder,
|
||||||
globPatterns: ['**/*'],
|
globPatterns: ['**/*'],
|
||||||
globIgnores: ['**/*.br'],
|
globIgnores: ['**/*.br', 'pwa-icons/**'],
|
||||||
manifestTransforms: [rewriteManifestIndexHtmlUrl],
|
manifestTransforms: [rewriteManifestIndexHtmlUrl],
|
||||||
maximumFileSizeToCacheInBytes: 100 * 1024 * 1024 // 100mb,
|
maximumFileSizeToCacheInBytes: 100 * 1024 * 1024 // 100mb,
|
||||||
});
|
});
|
||||||
@@ -117,11 +117,11 @@ function injectManifestToSWPlugin(): rollup.Plugin {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildSWPlugin(opts): PluginOption {
|
function buildSWPlugin(opts: { devMode: boolean }): PluginOption {
|
||||||
let config: ResolvedConfig;
|
let config: ResolvedConfig;
|
||||||
const devMode = opts.devMode;
|
const devMode = opts.devMode;
|
||||||
|
|
||||||
const swObj = {};
|
const swObj: { code?: string, map?: rollup.SourceMap | null } = {};
|
||||||
|
|
||||||
async function build(action: 'generate' | 'write', additionalPlugins: rollup.Plugin[] = []) {
|
async function build(action: 'generate' | 'write', additionalPlugins: rollup.Plugin[] = []) {
|
||||||
const includedPluginNames = [
|
const includedPluginNames = [
|
||||||
@@ -298,7 +298,7 @@ function statsExtracterPlugin(): PluginOption {
|
|||||||
|
|
||||||
const frontendFiles: Record<string, string> = {};
|
const frontendFiles: Record<string, string> = {};
|
||||||
|
|
||||||
const projectFileExtensions = ['.js', '.js.map', '.ts', '.ts.map', '.tsx', '.tsx.map', '.css', '.css.map'];
|
const projectFileExtensions = ['.js', '.js.map', '.ts', '.ts.map', '.tsx', '.tsx.map', '.css', '.css.map', '.'];
|
||||||
|
|
||||||
const isThemeComponentsResource = (id: string) =>
|
const isThemeComponentsResource = (id: string) =>
|
||||||
id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/'))
|
id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/'))
|
||||||
@@ -563,7 +563,7 @@ export { ${bindings.map(getExportBinding).join(', ')} };`;
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function themePlugin(opts): PluginOption {
|
function themePlugin(opts: { devMode: boolean }): PluginOption {
|
||||||
const fullThemeOptions = { ...themeOptions, devMode: opts.devMode };
|
const fullThemeOptions = { ...themeOptions, devMode: opts.devMode };
|
||||||
return {
|
return {
|
||||||
name: 'vaadin:theme',
|
name: 'vaadin:theme',
|
||||||
@@ -571,7 +571,7 @@ function themePlugin(opts): PluginOption {
|
|||||||
processThemeResources(fullThemeOptions, console);
|
processThemeResources(fullThemeOptions, console);
|
||||||
},
|
},
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
function handleThemeFileCreateDelete(themeFile, stats) {
|
function handleThemeFileCreateDelete(themeFile: string, stats?: Stats) {
|
||||||
if (themeFile.startsWith(themeFolder)) {
|
if (themeFile.startsWith(themeFolder)) {
|
||||||
const changed = path.relative(themeFolder, themeFile);
|
const changed = path.relative(themeFolder, themeFile);
|
||||||
console.debug('Theme file ' + (!!stats ? 'created' : 'deleted'), changed);
|
console.debug('Theme file ' + (!!stats ? 'created' : 'deleted'), changed);
|
||||||
@@ -632,8 +632,8 @@ function themePlugin(opts): PluginOption {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function runWatchDog(watchDogPort, watchDogHost) {
|
function runWatchDog(watchDogPort: number, watchDogHost: string | undefined) {
|
||||||
const client = net.Socket();
|
const client = new net.Socket();
|
||||||
client.setEncoding('utf8');
|
client.setEncoding('utf8');
|
||||||
client.on('error', function (err) {
|
client.on('error', function (err) {
|
||||||
console.log('Watchdog connection error. Terminating vite process...', err);
|
console.log('Watchdog connection error. Terminating vite process...', err);
|
||||||
@@ -692,7 +692,7 @@ export const vaadinConfig: UserConfigFn = (env) => {
|
|||||||
if (devMode && process.env.watchDogPort) {
|
if (devMode && process.env.watchDogPort) {
|
||||||
// Open a connection with the Java dev-mode handler in order to finish
|
// Open a connection with the Java dev-mode handler in order to finish
|
||||||
// vite when it exits or crashes.
|
// vite when it exits or crashes.
|
||||||
runWatchDog(process.env.watchDogPort, process.env.watchDogHost);
|
runWatchDog(parseInt(process.env.watchDogPort), process.env.watchDogHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -722,20 +722,19 @@ export const vaadinConfig: UserConfigFn = (env) => {
|
|||||||
outDir: buildOutputFolder,
|
outDir: buildOutputFolder,
|
||||||
emptyOutDir: devBundle,
|
emptyOutDir: devBundle,
|
||||||
assetsDir: 'VAADIN/build',
|
assetsDir: 'VAADIN/build',
|
||||||
target: ["esnext", "safari15"],
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
indexhtml: projectIndexHtml,
|
indexhtml: projectIndexHtml,
|
||||||
|
|
||||||
...(hasExportedWebComponents ? { webcomponenthtml: path.resolve(frontendFolder, 'web-component.html') } : {})
|
...(hasExportedWebComponents ? { webcomponenthtml: path.resolve(frontendFolder, 'web-component.html') } : {})
|
||||||
},
|
},
|
||||||
onwarn: (warning: rollup.RollupWarning, defaultHandler: rollup.WarningHandler) => {
|
onwarn: (warning: rollup.RollupLog, defaultHandler: rollup.LoggingFunction) => {
|
||||||
const ignoreEvalWarning = [
|
const ignoreEvalWarning = [
|
||||||
'generated/jar-resources/FlowClient.js',
|
'generated/jar-resources/FlowClient.js',
|
||||||
'generated/jar-resources/vaadin-spreadsheet/spreadsheet-export.js',
|
'generated/jar-resources/vaadin-spreadsheet/spreadsheet-export.js',
|
||||||
'@vaadin/charts/src/helpers.js'
|
'@vaadin/charts/src/helpers.js'
|
||||||
];
|
];
|
||||||
if (warning.code === 'EVAL' && warning.id && !!ignoreEvalWarning.find((id) => warning.id.endsWith(id))) {
|
if (warning.code === 'EVAL' && warning.id && !!ignoreEvalWarning.find((id) => warning.id?.endsWith(id))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
defaultHandler(warning);
|
defaultHandler(warning);
|
||||||
@@ -784,7 +783,13 @@ export const vaadinConfig: UserConfigFn = (env) => {
|
|||||||
presets: [['@babel/preset-react', { runtime: 'automatic', development: !productionMode }]],
|
presets: [['@babel/preset-react', { runtime: 'automatic', development: !productionMode }]],
|
||||||
// React writes the source location for where components are used, this writes for where they are defined
|
// React writes the source location for where components are used, this writes for where they are defined
|
||||||
plugins: [
|
plugins: [
|
||||||
!productionMode && addFunctionComponentSourceLocationBabel()
|
!productionMode && addFunctionComponentSourceLocationBabel(),
|
||||||
|
[
|
||||||
|
'module:@preact/signals-react-transform',
|
||||||
|
{
|
||||||
|
mode: 'all' // Needed to include translations which do not use something.value
|
||||||
|
}
|
||||||
|
]
|
||||||
].filter(Boolean)
|
].filter(Boolean)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
# Plugin versions
|
# Plugin versions
|
||||||
kotlinVersion=2.0.21
|
kotlinVersion=2.0.21
|
||||||
kspVersion=2.0.21-1.0.28
|
kspVersion=2.0.21-1.0.28
|
||||||
vaadinVersion=24.5.7
|
vaadinVersion=24.6.0
|
||||||
springBootVersion=3.4.0
|
springBootVersion=3.4.0
|
||||||
springCloudVersion=2024.0.0
|
springCloudVersion=2024.0.0
|
||||||
springDependencyManagementVersion=1.1.6
|
springDependencyManagementVersion=1.1.6
|
||||||
|
|||||||
Reference in New Issue
Block a user