@vue/compiler-dom 3.4.26 → 3.5.0-alpha.1
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/compiler-dom.cjs.js +176 -2
- package/dist/compiler-dom.cjs.prod.js +1 -1
- package/dist/compiler-dom.esm-browser.js +187 -9
- package/dist/compiler-dom.esm-browser.prod.js +2 -2
- package/dist/compiler-dom.esm-bundler.js +176 -2
- package/dist/compiler-dom.global.js +187 -9
- package/dist/compiler-dom.global.prod.js +2 -2
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-dom v3.
|
|
2
|
+
* @vue/compiler-dom v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2088,10 +2088,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2088
2088
|
}
|
|
2089
2089
|
},
|
|
2090
2090
|
onselfclosingtag(end) {
|
|
2091
|
+
var _a;
|
|
2091
2092
|
const name = currentOpenTag.tag;
|
|
2092
2093
|
currentOpenTag.isSelfClosing = true;
|
|
2093
2094
|
endOpenTag(end);
|
|
2094
|
-
if (stack[0]
|
|
2095
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
2095
2096
|
onCloseTag(stack.shift(), end);
|
|
2096
2097
|
}
|
|
2097
2098
|
},
|
|
@@ -2402,15 +2403,16 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2402
2403
|
currentOpenTag = null;
|
|
2403
2404
|
}
|
|
2404
2405
|
function onText(content, start, end) {
|
|
2406
|
+
var _a;
|
|
2405
2407
|
{
|
|
2406
|
-
const tag = stack[0]
|
|
2408
|
+
const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
|
|
2407
2409
|
if (tag !== "script" && tag !== "style" && content.includes("&")) {
|
|
2408
2410
|
content = currentOptions.decodeEntities(content, false);
|
|
2409
2411
|
}
|
|
2410
2412
|
}
|
|
2411
2413
|
const parent = stack[0] || currentRoot;
|
|
2412
2414
|
const lastNode = parent.children[parent.children.length - 1];
|
|
2413
|
-
if (lastNode
|
|
2415
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
2414
2416
|
lastNode.content += content;
|
|
2415
2417
|
setLocEnd(lastNode.loc, end);
|
|
2416
2418
|
} else {
|
|
@@ -2544,10 +2546,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2544
2546
|
return false;
|
|
2545
2547
|
}
|
|
2546
2548
|
function isComponent({ tag, props }) {
|
|
2549
|
+
var _a;
|
|
2547
2550
|
if (currentOptions.isCustomElement(tag)) {
|
|
2548
2551
|
return false;
|
|
2549
2552
|
}
|
|
2550
|
-
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent
|
|
2553
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
2551
2554
|
return true;
|
|
2552
2555
|
}
|
|
2553
2556
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -2580,6 +2583,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2580
2583
|
}
|
|
2581
2584
|
const windowsNewlineRE = /\r\n/g;
|
|
2582
2585
|
function condenseWhitespace(nodes, tag) {
|
|
2586
|
+
var _a, _b;
|
|
2583
2587
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2584
2588
|
let removedWhitespace = false;
|
|
2585
2589
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2587,8 +2591,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2587
2591
|
if (node.type === 2) {
|
|
2588
2592
|
if (!inPre) {
|
|
2589
2593
|
if (isAllWhitespace(node.content)) {
|
|
2590
|
-
const prev = nodes[i - 1]
|
|
2591
|
-
const next = nodes[i + 1]
|
|
2594
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
2595
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
2592
2596
|
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2593
2597
|
removedWhitespace = true;
|
|
2594
2598
|
nodes[i] = null;
|
|
@@ -2726,7 +2730,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
2726
2730
|
}
|
|
2727
2731
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2728
2732
|
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
2729
|
-
const delimiters = options
|
|
2733
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2730
2734
|
if (delimiters) {
|
|
2731
2735
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
2732
2736
|
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
@@ -6273,9 +6277,183 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
6273
6277
|
}
|
|
6274
6278
|
};
|
|
6275
6279
|
|
|
6280
|
+
function isValidHTMLNesting(parent, child) {
|
|
6281
|
+
if (parent in onlyValidChildren) {
|
|
6282
|
+
return onlyValidChildren[parent].has(child);
|
|
6283
|
+
}
|
|
6284
|
+
if (child in onlyValidParents) {
|
|
6285
|
+
return onlyValidParents[child].has(parent);
|
|
6286
|
+
}
|
|
6287
|
+
if (parent in knownInvalidChildren) {
|
|
6288
|
+
if (knownInvalidChildren[parent].has(child))
|
|
6289
|
+
return false;
|
|
6290
|
+
}
|
|
6291
|
+
if (child in knownInvalidParents) {
|
|
6292
|
+
if (knownInvalidParents[child].has(parent))
|
|
6293
|
+
return false;
|
|
6294
|
+
}
|
|
6295
|
+
return true;
|
|
6296
|
+
}
|
|
6297
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
6298
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
6299
|
+
const onlyValidChildren = {
|
|
6300
|
+
head: /* @__PURE__ */ new Set([
|
|
6301
|
+
"base",
|
|
6302
|
+
"basefront",
|
|
6303
|
+
"bgsound",
|
|
6304
|
+
"link",
|
|
6305
|
+
"meta",
|
|
6306
|
+
"title",
|
|
6307
|
+
"noscript",
|
|
6308
|
+
"noframes",
|
|
6309
|
+
"style",
|
|
6310
|
+
"script",
|
|
6311
|
+
"template"
|
|
6312
|
+
]),
|
|
6313
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
6314
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
6315
|
+
// table
|
|
6316
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
6317
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
6318
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
6319
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
6320
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
6321
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
6322
|
+
// these elements can not have any children elements
|
|
6323
|
+
script: emptySet,
|
|
6324
|
+
iframe: emptySet,
|
|
6325
|
+
option: emptySet,
|
|
6326
|
+
textarea: emptySet,
|
|
6327
|
+
style: emptySet,
|
|
6328
|
+
title: emptySet
|
|
6329
|
+
};
|
|
6330
|
+
const onlyValidParents = {
|
|
6331
|
+
// sections
|
|
6332
|
+
html: emptySet,
|
|
6333
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
6334
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
6335
|
+
// table
|
|
6336
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
6337
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
6338
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
6339
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
6340
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
6341
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
6342
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
6343
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
6344
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
6345
|
+
// data list
|
|
6346
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
6347
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
6348
|
+
// other
|
|
6349
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
6350
|
+
// li: new Set(["ul", "ol"]),
|
|
6351
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
6352
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
6353
|
+
};
|
|
6354
|
+
const knownInvalidChildren = {
|
|
6355
|
+
p: /* @__PURE__ */ new Set([
|
|
6356
|
+
"address",
|
|
6357
|
+
"article",
|
|
6358
|
+
"aside",
|
|
6359
|
+
"blockquote",
|
|
6360
|
+
"center",
|
|
6361
|
+
"details",
|
|
6362
|
+
"dialog",
|
|
6363
|
+
"dir",
|
|
6364
|
+
"div",
|
|
6365
|
+
"dl",
|
|
6366
|
+
"fieldset",
|
|
6367
|
+
"figure",
|
|
6368
|
+
"footer",
|
|
6369
|
+
"form",
|
|
6370
|
+
"h1",
|
|
6371
|
+
"h2",
|
|
6372
|
+
"h3",
|
|
6373
|
+
"h4",
|
|
6374
|
+
"h5",
|
|
6375
|
+
"h6",
|
|
6376
|
+
"header",
|
|
6377
|
+
"hgroup",
|
|
6378
|
+
"hr",
|
|
6379
|
+
"li",
|
|
6380
|
+
"main",
|
|
6381
|
+
"nav",
|
|
6382
|
+
"menu",
|
|
6383
|
+
"ol",
|
|
6384
|
+
"p",
|
|
6385
|
+
"pre",
|
|
6386
|
+
"section",
|
|
6387
|
+
"table",
|
|
6388
|
+
"ul"
|
|
6389
|
+
]),
|
|
6390
|
+
svg: /* @__PURE__ */ new Set([
|
|
6391
|
+
"b",
|
|
6392
|
+
"blockquote",
|
|
6393
|
+
"br",
|
|
6394
|
+
"code",
|
|
6395
|
+
"dd",
|
|
6396
|
+
"div",
|
|
6397
|
+
"dl",
|
|
6398
|
+
"dt",
|
|
6399
|
+
"em",
|
|
6400
|
+
"embed",
|
|
6401
|
+
"h1",
|
|
6402
|
+
"h2",
|
|
6403
|
+
"h3",
|
|
6404
|
+
"h4",
|
|
6405
|
+
"h5",
|
|
6406
|
+
"h6",
|
|
6407
|
+
"hr",
|
|
6408
|
+
"i",
|
|
6409
|
+
"img",
|
|
6410
|
+
"li",
|
|
6411
|
+
"menu",
|
|
6412
|
+
"meta",
|
|
6413
|
+
"ol",
|
|
6414
|
+
"p",
|
|
6415
|
+
"pre",
|
|
6416
|
+
"ruby",
|
|
6417
|
+
"s",
|
|
6418
|
+
"small",
|
|
6419
|
+
"span",
|
|
6420
|
+
"strong",
|
|
6421
|
+
"sub",
|
|
6422
|
+
"sup",
|
|
6423
|
+
"table",
|
|
6424
|
+
"u",
|
|
6425
|
+
"ul",
|
|
6426
|
+
"var"
|
|
6427
|
+
])
|
|
6428
|
+
};
|
|
6429
|
+
const knownInvalidParents = {
|
|
6430
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
6431
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
6432
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
6433
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
6434
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
6435
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
6436
|
+
h1: headings,
|
|
6437
|
+
h2: headings,
|
|
6438
|
+
h3: headings,
|
|
6439
|
+
h4: headings,
|
|
6440
|
+
h5: headings,
|
|
6441
|
+
h6: headings
|
|
6442
|
+
};
|
|
6443
|
+
|
|
6444
|
+
const validateHtmlNesting = (node, context) => {
|
|
6445
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
6446
|
+
const error = new SyntaxError(
|
|
6447
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
6448
|
+
);
|
|
6449
|
+
error.loc = node.loc;
|
|
6450
|
+
context.onWarn(error);
|
|
6451
|
+
}
|
|
6452
|
+
};
|
|
6453
|
+
|
|
6276
6454
|
const DOMNodeTransforms = [
|
|
6277
6455
|
transformStyle,
|
|
6278
|
-
...[transformTransition]
|
|
6456
|
+
...[transformTransition, validateHtmlNesting]
|
|
6279
6457
|
];
|
|
6280
6458
|
const DOMDirectiveTransforms = {
|
|
6281
6459
|
cloak: noopDirectiveTransform,
|