« get me outta code hell

infra: statically pre-validate content function slots - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-01 13:29:52 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-01 20:06:23 -0400
commite0defee7f7ab50bf3e6d33d6ab04f6c6795bab27 (patch)
treeac5a5d15615dec8768c73e2575e6769553aa6451
parent6c7c81fcdb5574c47fc59809005d1066123abb28 (diff)
infra: statically pre-validate content function slots
-rw-r--r--src/content-function.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/content-function.js b/src/content-function.js
index f57b606a..729211f1 100644
--- a/src/content-function.js
+++ b/src/content-function.js
@@ -1,3 +1,5 @@
+import {Template} from '#html';
+
 import {
   annotateFunction,
   decorateErrorWithCause,
@@ -44,6 +46,10 @@ export default function contentFunction({
     throw new ContentFunctionSpecError(`Content functions with slots must specify html in extraDependencies`);
   }
 
+  if (slots) {
+    Template.validateSlotsDescription(slots);
+  }
+
   // Pass all the details to expectDependencies, which will recursively build
   // up a set of fulfilled dependencies and make functions like `relations`
   // and `generate` callable only with sufficient fulfilled dependencies.