« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write/build-modes
diff options
context:
space:
mode:
Diffstat (limited to 'src/write/build-modes')
-rw-r--r--src/write/build-modes/live-dev-server.js19
-rw-r--r--src/write/build-modes/static-build.js19
2 files changed, 16 insertions, 22 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index e3ab21d5..8af37d3a 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -428,25 +428,22 @@ export async function go({
 
       const slotResults = {};
 
-      function runContentFunction({name, args, relations: flatRelations}) {
+      function runContentFunction({name, args, relations: layout}) {
         const contentFunction = fulfilledContentDependencies[name];
 
         if (!contentFunction) {
           throw new Error(`Content function ${name} unfulfilled or not listed`);
         }
 
-        const sprawl =
-          contentFunction.sprawl?.(allExtraDependencies.wikiData, ...args);
+        const generateArgs = [];
 
-        const relations =
-          fillRelationsLayoutFromSlotResults(relationIdentifier, slotResults, flatRelations);
-
-        const data =
-          (sprawl
-            ? contentFunction.data?.(sprawl, ...args)
-            : contentFunction.data?.(...args));
+        if (contentFunction.data) {
+          generateArgs.push(contentFunction.data(...args));
+        }
 
-        const generateArgs = [data, relations].filter(Boolean);
+        if (layout) {
+          generateArgs.push(fillRelationsLayoutFromSlotResults(relationIdentifier, slotResults, layout));
+        }
 
         return contentFunction(...generateArgs);
       }
diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js
index e0b4ab16..67a4df67 100644
--- a/src/write/build-modes/static-build.js
+++ b/src/write/build-modes/static-build.js
@@ -390,25 +390,22 @@ export async function go({
 
         const slotResults = {};
 
-        function runContentFunction({name, args, relations: flatRelations}) {
+        function runContentFunction({name, args, relations: layout}) {
           const contentFunction = fulfilledContentDependencies[name];
 
           if (!contentFunction) {
             throw new Error(`Content function ${name} unfulfilled or not listed`);
           }
 
-          const sprawl =
-            contentFunction.sprawl?.(allExtraDependencies.wikiData, ...args);
+          const generateArgs = [];
 
-          const relations =
-            fillRelationsLayoutFromSlotResults(relationIdentifier, slotResults, flatRelations);
-
-          const data =
-            (sprawl
-              ? contentFunction.data?.(sprawl, ...args)
-              : contentFunction.data?.(...args));
+          if (contentFunction.data) {
+            generateArgs.push(contentFunction.data(...args));
+          }
 
-          const generateArgs = [data, relations].filter(Boolean);
+          if (layout) {
+            generateArgs.push(fillRelationsLayoutFromSlotResults(relationIdentifier, slotResults, layout));
+          }
 
           return contentFunction(...generateArgs);
         }