@vue/compiler-dom
Advanced tools
Comparing version 3.4.25 to 3.5.0-alpha.1
/** | ||
* @vue/compiler-dom v3.4.25 | ||
* @vue/compiler-dom v3.5.0-alpha.1 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -667,5 +667,179 @@ * @license MIT | ||
function isValidHTMLNesting(parent, child) { | ||
if (parent in onlyValidChildren) { | ||
return onlyValidChildren[parent].has(child); | ||
} | ||
if (child in onlyValidParents) { | ||
return onlyValidParents[child].has(parent); | ||
} | ||
if (parent in knownInvalidChildren) { | ||
if (knownInvalidChildren[parent].has(child)) | ||
return false; | ||
} | ||
if (child in knownInvalidParents) { | ||
if (knownInvalidParents[child].has(parent)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); | ||
const emptySet = /* @__PURE__ */ new Set([]); | ||
const onlyValidChildren = { | ||
head: /* @__PURE__ */ new Set([ | ||
"base", | ||
"basefront", | ||
"bgsound", | ||
"link", | ||
"meta", | ||
"title", | ||
"noscript", | ||
"noframes", | ||
"style", | ||
"script", | ||
"template" | ||
]), | ||
optgroup: /* @__PURE__ */ new Set(["option"]), | ||
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), | ||
// table | ||
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), | ||
tr: /* @__PURE__ */ new Set(["td", "th"]), | ||
colgroup: /* @__PURE__ */ new Set(["col"]), | ||
tbody: /* @__PURE__ */ new Set(["tr"]), | ||
thead: /* @__PURE__ */ new Set(["tr"]), | ||
tfoot: /* @__PURE__ */ new Set(["tr"]), | ||
// these elements can not have any children elements | ||
script: emptySet, | ||
iframe: emptySet, | ||
option: emptySet, | ||
textarea: emptySet, | ||
style: emptySet, | ||
title: emptySet | ||
}; | ||
const onlyValidParents = { | ||
// sections | ||
html: emptySet, | ||
body: /* @__PURE__ */ new Set(["html"]), | ||
head: /* @__PURE__ */ new Set(["html"]), | ||
// table | ||
td: /* @__PURE__ */ new Set(["tr"]), | ||
colgroup: /* @__PURE__ */ new Set(["table"]), | ||
caption: /* @__PURE__ */ new Set(["table"]), | ||
tbody: /* @__PURE__ */ new Set(["table"]), | ||
tfoot: /* @__PURE__ */ new Set(["table"]), | ||
col: /* @__PURE__ */ new Set(["colgroup"]), | ||
th: /* @__PURE__ */ new Set(["tr"]), | ||
thead: /* @__PURE__ */ new Set(["table"]), | ||
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), | ||
// data list | ||
dd: /* @__PURE__ */ new Set(["dl", "div"]), | ||
dt: /* @__PURE__ */ new Set(["dl", "div"]), | ||
// other | ||
figcaption: /* @__PURE__ */ new Set(["figure"]), | ||
// li: new Set(["ul", "ol"]), | ||
summary: /* @__PURE__ */ new Set(["details"]), | ||
area: /* @__PURE__ */ new Set(["map"]) | ||
}; | ||
const knownInvalidChildren = { | ||
p: /* @__PURE__ */ new Set([ | ||
"address", | ||
"article", | ||
"aside", | ||
"blockquote", | ||
"center", | ||
"details", | ||
"dialog", | ||
"dir", | ||
"div", | ||
"dl", | ||
"fieldset", | ||
"figure", | ||
"footer", | ||
"form", | ||
"h1", | ||
"h2", | ||
"h3", | ||
"h4", | ||
"h5", | ||
"h6", | ||
"header", | ||
"hgroup", | ||
"hr", | ||
"li", | ||
"main", | ||
"nav", | ||
"menu", | ||
"ol", | ||
"p", | ||
"pre", | ||
"section", | ||
"table", | ||
"ul" | ||
]), | ||
svg: /* @__PURE__ */ new Set([ | ||
"b", | ||
"blockquote", | ||
"br", | ||
"code", | ||
"dd", | ||
"div", | ||
"dl", | ||
"dt", | ||
"em", | ||
"embed", | ||
"h1", | ||
"h2", | ||
"h3", | ||
"h4", | ||
"h5", | ||
"h6", | ||
"hr", | ||
"i", | ||
"img", | ||
"li", | ||
"menu", | ||
"meta", | ||
"ol", | ||
"p", | ||
"pre", | ||
"ruby", | ||
"s", | ||
"small", | ||
"span", | ||
"strong", | ||
"sub", | ||
"sup", | ||
"table", | ||
"u", | ||
"ul", | ||
"var" | ||
]) | ||
}; | ||
const knownInvalidParents = { | ||
a: /* @__PURE__ */ new Set(["a"]), | ||
button: /* @__PURE__ */ new Set(["button"]), | ||
dd: /* @__PURE__ */ new Set(["dd", "dt"]), | ||
dt: /* @__PURE__ */ new Set(["dd", "dt"]), | ||
form: /* @__PURE__ */ new Set(["form"]), | ||
li: /* @__PURE__ */ new Set(["li"]), | ||
h1: headings, | ||
h2: headings, | ||
h3: headings, | ||
h4: headings, | ||
h5: headings, | ||
h6: headings | ||
}; | ||
const validateHtmlNesting = (node, context) => { | ||
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { | ||
const error = new SyntaxError( | ||
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` | ||
); | ||
error.loc = node.loc; | ||
context.onWarn(error); | ||
} | ||
}; | ||
const DOMNodeTransforms = [ | ||
transformStyle, | ||
...[transformTransition] | ||
...[transformTransition, validateHtmlNesting] | ||
]; | ||
@@ -672,0 +846,0 @@ const DOMDirectiveTransforms = { |
/** | ||
* @vue/compiler-dom v3.4.25 | ||
* @vue/compiler-dom v3.5.0-alpha.1 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -4,0 +4,0 @@ * @license MIT |
/** | ||
* @vue/compiler-dom v3.4.25 | ||
* @vue/compiler-dom v3.5.0-alpha.1 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -467,5 +467,179 @@ * @license MIT | ||
function isValidHTMLNesting(parent, child) { | ||
if (parent in onlyValidChildren) { | ||
return onlyValidChildren[parent].has(child); | ||
} | ||
if (child in onlyValidParents) { | ||
return onlyValidParents[child].has(parent); | ||
} | ||
if (parent in knownInvalidChildren) { | ||
if (knownInvalidChildren[parent].has(child)) | ||
return false; | ||
} | ||
if (child in knownInvalidParents) { | ||
if (knownInvalidParents[child].has(parent)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]); | ||
const emptySet = /* @__PURE__ */ new Set([]); | ||
const onlyValidChildren = { | ||
head: /* @__PURE__ */ new Set([ | ||
"base", | ||
"basefront", | ||
"bgsound", | ||
"link", | ||
"meta", | ||
"title", | ||
"noscript", | ||
"noframes", | ||
"style", | ||
"script", | ||
"template" | ||
]), | ||
optgroup: /* @__PURE__ */ new Set(["option"]), | ||
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]), | ||
// table | ||
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]), | ||
tr: /* @__PURE__ */ new Set(["td", "th"]), | ||
colgroup: /* @__PURE__ */ new Set(["col"]), | ||
tbody: /* @__PURE__ */ new Set(["tr"]), | ||
thead: /* @__PURE__ */ new Set(["tr"]), | ||
tfoot: /* @__PURE__ */ new Set(["tr"]), | ||
// these elements can not have any children elements | ||
script: emptySet, | ||
iframe: emptySet, | ||
option: emptySet, | ||
textarea: emptySet, | ||
style: emptySet, | ||
title: emptySet | ||
}; | ||
const onlyValidParents = { | ||
// sections | ||
html: emptySet, | ||
body: /* @__PURE__ */ new Set(["html"]), | ||
head: /* @__PURE__ */ new Set(["html"]), | ||
// table | ||
td: /* @__PURE__ */ new Set(["tr"]), | ||
colgroup: /* @__PURE__ */ new Set(["table"]), | ||
caption: /* @__PURE__ */ new Set(["table"]), | ||
tbody: /* @__PURE__ */ new Set(["table"]), | ||
tfoot: /* @__PURE__ */ new Set(["table"]), | ||
col: /* @__PURE__ */ new Set(["colgroup"]), | ||
th: /* @__PURE__ */ new Set(["tr"]), | ||
thead: /* @__PURE__ */ new Set(["table"]), | ||
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]), | ||
// data list | ||
dd: /* @__PURE__ */ new Set(["dl", "div"]), | ||
dt: /* @__PURE__ */ new Set(["dl", "div"]), | ||
// other | ||
figcaption: /* @__PURE__ */ new Set(["figure"]), | ||
// li: new Set(["ul", "ol"]), | ||
summary: /* @__PURE__ */ new Set(["details"]), | ||
area: /* @__PURE__ */ new Set(["map"]) | ||
}; | ||
const knownInvalidChildren = { | ||
p: /* @__PURE__ */ new Set([ | ||
"address", | ||
"article", | ||
"aside", | ||
"blockquote", | ||
"center", | ||
"details", | ||
"dialog", | ||
"dir", | ||
"div", | ||
"dl", | ||
"fieldset", | ||
"figure", | ||
"footer", | ||
"form", | ||
"h1", | ||
"h2", | ||
"h3", | ||
"h4", | ||
"h5", | ||
"h6", | ||
"header", | ||
"hgroup", | ||
"hr", | ||
"li", | ||
"main", | ||
"nav", | ||
"menu", | ||
"ol", | ||
"p", | ||
"pre", | ||
"section", | ||
"table", | ||
"ul" | ||
]), | ||
svg: /* @__PURE__ */ new Set([ | ||
"b", | ||
"blockquote", | ||
"br", | ||
"code", | ||
"dd", | ||
"div", | ||
"dl", | ||
"dt", | ||
"em", | ||
"embed", | ||
"h1", | ||
"h2", | ||
"h3", | ||
"h4", | ||
"h5", | ||
"h6", | ||
"hr", | ||
"i", | ||
"img", | ||
"li", | ||
"menu", | ||
"meta", | ||
"ol", | ||
"p", | ||
"pre", | ||
"ruby", | ||
"s", | ||
"small", | ||
"span", | ||
"strong", | ||
"sub", | ||
"sup", | ||
"table", | ||
"u", | ||
"ul", | ||
"var" | ||
]) | ||
}; | ||
const knownInvalidParents = { | ||
a: /* @__PURE__ */ new Set(["a"]), | ||
button: /* @__PURE__ */ new Set(["button"]), | ||
dd: /* @__PURE__ */ new Set(["dd", "dt"]), | ||
dt: /* @__PURE__ */ new Set(["dd", "dt"]), | ||
form: /* @__PURE__ */ new Set(["form"]), | ||
li: /* @__PURE__ */ new Set(["li"]), | ||
h1: headings, | ||
h2: headings, | ||
h3: headings, | ||
h4: headings, | ||
h5: headings, | ||
h6: headings | ||
}; | ||
const validateHtmlNesting = (node, context) => { | ||
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) { | ||
const error = new SyntaxError( | ||
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.` | ||
); | ||
error.loc = node.loc; | ||
context.onWarn(error); | ||
} | ||
}; | ||
const DOMNodeTransforms = [ | ||
transformStyle, | ||
...!!(process.env.NODE_ENV !== "production") ? [transformTransition] : [] | ||
...!!(process.env.NODE_ENV !== "production") ? [transformTransition, validateHtmlNesting] : [] | ||
]; | ||
@@ -472,0 +646,0 @@ const DOMDirectiveTransforms = { |
{ | ||
"name": "@vue/compiler-dom", | ||
"version": "3.4.25", | ||
"version": "3.5.0-alpha.1", | ||
"description": "@vue/compiler-dom", | ||
@@ -54,5 +54,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "3.4.25", | ||
"@vue/compiler-core": "3.4.25" | ||
"@vue/shared": "3.5.0-alpha.1", | ||
"@vue/compiler-core": "3.5.0-alpha.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
628087
15917
1
+ Added@vue/compiler-core@3.5.0-alpha.1(transitive)
+ Added@vue/shared@3.5.0-alpha.1(transitive)
- Removed@vue/compiler-core@3.4.25(transitive)
- Removed@vue/shared@3.4.25(transitive)
Updated@vue/shared@3.5.0-alpha.1