@marko/runtime-tags 6.1.14 → 6.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/debug/dom.js CHANGED
@@ -105,6 +105,10 @@ function normalizeDynamicRenderer(value) {
105
105
  if (value) {
106
106
  if (typeof value === "string") return value;
107
107
  const normalized = value.content || value.default || value;
108
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
109
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
110
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
111
+ }
108
112
  if ("id" in normalized) return normalized;
109
113
  }
110
114
  }
@@ -103,6 +103,10 @@ function normalizeDynamicRenderer(value) {
103
103
  if (value) {
104
104
  if (typeof value === "string") return value;
105
105
  const normalized = value.content || value.default || value;
106
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
107
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
108
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
109
+ }
106
110
  if ("id" in normalized) return normalized;
107
111
  }
108
112
  }
@@ -104,6 +104,10 @@ function normalizeDynamicRenderer(value) {
104
104
  if (value) {
105
105
  if (typeof value === "string") return value;
106
106
  const normalized = value.content || value.default || value;
107
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
108
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
109
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
110
+ }
107
111
  if ("id" in normalized) return normalized;
108
112
  }
109
113
  }
@@ -2643,7 +2647,6 @@ const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta
2643
2647
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2644
2648
  const shouldResume = serializeReason !== 0;
2645
2649
  const renderer = normalizeDynamicRenderer(tag);
2646
- if (renderer && typeof renderer !== "function" && typeof renderer !== "string") throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
2647
2650
  const state = getState();
2648
2651
  const branchId = _peek_scope_id();
2649
2652
  let rendered;
@@ -102,6 +102,10 @@ function normalizeDynamicRenderer(value) {
102
102
  if (value) {
103
103
  if (typeof value === "string") return value;
104
104
  const normalized = value.content || value.default || value;
105
+ if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
106
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
107
+ if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
108
+ }
105
109
  if ("id" in normalized) return normalized;
106
110
  }
107
111
  }
@@ -2641,7 +2645,6 @@ const voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta
2641
2645
  let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
2642
2646
  const shouldResume = serializeReason !== 0;
2643
2647
  const renderer = normalizeDynamicRenderer(tag);
2644
- if (renderer && typeof renderer !== "function" && typeof renderer !== "string") throw new Error(`Invalid renderer passed for dynamic tag: ${renderer}`);
2645
2648
  const state = getState();
2646
2649
  const branchId = _peek_scope_id();
2647
2650
  let rendered;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.1.14",
3
+ "version": "6.1.15",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",