Add glutenfree theme, fix #2031, some other improvements to fix output

This commit is contained in:
Pieter Vander Vennet 2024-07-18 17:58:39 +02:00
parent 29ee4ae155
commit f4fc954564
8 changed files with 41 additions and 16 deletions

View file

@ -71,6 +71,10 @@ class SubstituteLayer extends Conversion<string | LayerConfigJson, LayerConfigJs
for (const name of names) {
const found = Utils.Clone(state.sharedLayers.get(name))
if(found === undefined){
context.err("Layer with name "+name+" not found")
continue
}
found["_basedOn"] = name
if (found === undefined) {
reportNotFound(name)
@ -367,7 +371,8 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
private static CalculateDependencies(
alreadyLoaded: LayerConfigJson[],
allKnownLayers: Map<string, LayerConfigJson>,
themeId: string
themeId: string,
context: ConversionContext
): { config: LayerConfigJson; reason: string }[] {
const dependenciesToAdd: { config: LayerConfigJson; reason: string }[] = []
const loadedLayerIds: Set<string> = new Set<string>(alreadyLoaded.map((l) => l?.id))
@ -388,6 +393,7 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
}[] = []
for (const layerConfig of alreadyLoaded) {
try {
const layerDeps = DependencyCalculator.getLayerDependencies(
new LayerConfig(layerConfig, themeId + "(dependencies)")
@ -396,7 +402,7 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
} catch (e) {
console.error(e)
throw (
"Detecting layer dependencies for " + layerConfig.id + " failed due to " + e
"Detecting layer dependencies for " + layerConfig?.id + " failed due to " + e
)
}
}
@ -467,7 +473,8 @@ class AddDependencyLayersToTheme extends DesugaringStep<LayoutConfigJson> {
const dependencies = AddDependencyLayersToTheme.CalculateDependencies(
layers,
allKnownLayers,
theme.id
theme.id,
context
)
if (dependencies.length > 0) {
for (const dependency of dependencies) {