@vue/compiler-dom-canary
Advanced tools
Comparing version 3.20240701.0 to 3.20240701.1-minor.0
/** | ||
* @vue/compiler-dom-canary v3.20240701.0 | ||
* @vue/compiler-dom-canary v3.20240701.1-minor.0 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -448,2 +448,3 @@ * @license MIT | ||
} | ||
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20; | ||
let nc = 0; | ||
@@ -462,10 +463,21 @@ let ec = 0; | ||
]); | ||
replaceHoist(currentChunk[0], staticCall, context); | ||
if (currentChunk.length > 1) { | ||
for (let i2 = 1; i2 < currentChunk.length; i2++) { | ||
replaceHoist(currentChunk[i2], null, context); | ||
if (isParentCached) { | ||
parent.codegenNode.children.value = compilerCore.createArrayExpression([staticCall]); | ||
} else { | ||
currentChunk[0].codegenNode.value = staticCall; | ||
if (currentChunk.length > 1) { | ||
const deleteCount = currentChunk.length - 1; | ||
children.splice(currentIndex - currentChunk.length + 1, deleteCount); | ||
const cacheIndex = context.cached.indexOf( | ||
currentChunk[currentChunk.length - 1].codegenNode | ||
); | ||
if (cacheIndex > -1) { | ||
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) { | ||
const c = context.cached[i2]; | ||
if (c) c.index -= deleteCount; | ||
} | ||
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount); | ||
} | ||
return deleteCount; | ||
} | ||
const deleteCount = currentChunk.length - 1; | ||
children.splice(currentIndex - currentChunk.length + 1, deleteCount); | ||
return deleteCount; | ||
} | ||
@@ -478,10 +490,9 @@ } | ||
const child = children[i]; | ||
const hoisted = getHoistedNode(child); | ||
if (hoisted) { | ||
const node = child; | ||
const result = analyzeNode(node); | ||
const isCached = isParentCached || getCachedNode(child); | ||
if (isCached) { | ||
const result = analyzeNode(child); | ||
if (result) { | ||
nc += result[0]; | ||
ec += result[1]; | ||
currentChunk.push(node); | ||
currentChunk.push(child); | ||
continue; | ||
@@ -497,3 +508,7 @@ } | ||
}; | ||
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted; | ||
const getCachedNode = (node) => { | ||
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) { | ||
return node.codegenNode; | ||
} | ||
}; | ||
const dataAriaRE = /^(data|aria)-/; | ||
@@ -503,6 +518,2 @@ const isStringifiableAttr = (name, ns) => { | ||
}; | ||
const replaceHoist = (node, replacement, context) => { | ||
const hoistToReplace = node.codegenNode.hoisted; | ||
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement; | ||
}; | ||
const isNonStringifiable = /* @__PURE__ */ shared.makeMap( | ||
@@ -675,5 +686,177 @@ `caption,thead,tr,th,tbody,td,tfoot,colgroup,col` | ||
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] | ||
]; | ||
@@ -680,0 +863,0 @@ const DOMDirectiveTransforms = { |
/** | ||
* @vue/compiler-dom-canary v3.20240701.0 | ||
* @vue/compiler-dom-canary v3.20240701.1-minor.0 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -384,2 +384,3 @@ * @license MIT | ||
} | ||
const isParentCached = parent.type === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !shared.isArray(parent.codegenNode.children) && parent.codegenNode.children.type === 20; | ||
let nc = 0; | ||
@@ -398,10 +399,21 @@ let ec = 0; | ||
]); | ||
replaceHoist(currentChunk[0], staticCall, context); | ||
if (currentChunk.length > 1) { | ||
for (let i2 = 1; i2 < currentChunk.length; i2++) { | ||
replaceHoist(currentChunk[i2], null, context); | ||
if (isParentCached) { | ||
parent.codegenNode.children.value = compilerCore.createArrayExpression([staticCall]); | ||
} else { | ||
currentChunk[0].codegenNode.value = staticCall; | ||
if (currentChunk.length > 1) { | ||
const deleteCount = currentChunk.length - 1; | ||
children.splice(currentIndex - currentChunk.length + 1, deleteCount); | ||
const cacheIndex = context.cached.indexOf( | ||
currentChunk[currentChunk.length - 1].codegenNode | ||
); | ||
if (cacheIndex > -1) { | ||
for (let i2 = cacheIndex; i2 < context.cached.length; i2++) { | ||
const c = context.cached[i2]; | ||
if (c) c.index -= deleteCount; | ||
} | ||
context.cached.splice(cacheIndex - deleteCount + 1, deleteCount); | ||
} | ||
return deleteCount; | ||
} | ||
const deleteCount = currentChunk.length - 1; | ||
children.splice(currentIndex - currentChunk.length + 1, deleteCount); | ||
return deleteCount; | ||
} | ||
@@ -414,10 +426,9 @@ } | ||
const child = children[i]; | ||
const hoisted = getHoistedNode(child); | ||
if (hoisted) { | ||
const node = child; | ||
const result = analyzeNode(node); | ||
const isCached = isParentCached || getCachedNode(child); | ||
if (isCached) { | ||
const result = analyzeNode(child); | ||
if (result) { | ||
nc += result[0]; | ||
ec += result[1]; | ||
currentChunk.push(node); | ||
currentChunk.push(child); | ||
continue; | ||
@@ -433,3 +444,7 @@ } | ||
}; | ||
const getHoistedNode = (node) => (node.type === 1 && node.tagType === 0 || node.type == 12) && node.codegenNode && node.codegenNode.type === 4 && node.codegenNode.hoisted; | ||
const getCachedNode = (node) => { | ||
if ((node.type === 1 && node.tagType === 0 || node.type === 12) && node.codegenNode && node.codegenNode.type === 20) { | ||
return node.codegenNode; | ||
} | ||
}; | ||
const dataAriaRE = /^(data|aria)-/; | ||
@@ -439,6 +454,2 @@ const isStringifiableAttr = (name, ns) => { | ||
}; | ||
const replaceHoist = (node, replacement, context) => { | ||
const hoistToReplace = node.codegenNode.hoisted; | ||
context.hoists[context.hoists.indexOf(hoistToReplace)] = replacement; | ||
}; | ||
const isNonStringifiable = /* @__PURE__ */ shared.makeMap( | ||
@@ -445,0 +456,0 @@ `caption,thead,tr,th,tbody,td,tfoot,colgroup,col` |
/** | ||
* @vue/compiler-dom-canary v3.20240701.0 | ||
* @vue/compiler-dom-canary v3.20240701.1-minor.0 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -466,5 +466,177 @@ * @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] : [] | ||
]; | ||
@@ -471,0 +643,0 @@ const DOMDirectiveTransforms = { |
{ | ||
"name": "@vue/compiler-dom-canary", | ||
"version": "3.20240701.0", | ||
"version": "3.20240701.1-minor.0", | ||
"description": "@vue/compiler-dom", | ||
@@ -54,5 +54,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"@vue/shared": "npm:@vue/shared-canary@3.20240701.0", | ||
"@vue/compiler-core": "npm:@vue/compiler-core-canary@3.20240701.0" | ||
"@vue/shared": "npm:@vue/shared-canary@3.20240701.1-minor.0", | ||
"@vue/compiler-core": "npm:@vue/compiler-core-canary@3.20240701.1-minor.0" | ||
} | ||
} |
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
634869
16006
1
+ Added@vue/compiler-core-canary@3.20240701.1-minor.0(transitive)
+ Added@vue/shared-canary@3.20240701.1-minor.0(transitive)
- Removed@vue/compiler-core-canary@3.20240701.0(transitive)
- Removed@vue/shared-canary@3.20240701.0(transitive)
Updated@vue/compiler-core@npm:@vue/compiler-core-canary@3.20240701.1-minor.0
Updated@vue/shared@npm:@vue/shared-canary@3.20240701.1-minor.0