@vue/compiler-core 3.5.16 → 3.5.18
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.5.
|
|
2
|
+
* @vue/compiler-core v3.5.18
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1063,7 +1063,7 @@ class Tokenizer {
|
|
|
1063
1063
|
this.buffer = input;
|
|
1064
1064
|
while (this.index < this.buffer.length) {
|
|
1065
1065
|
const c = this.buffer.charCodeAt(this.index);
|
|
1066
|
-
if (c === 10) {
|
|
1066
|
+
if (c === 10 && this.state !== 33) {
|
|
1067
1067
|
this.newlines.push(this.index);
|
|
1068
1068
|
}
|
|
1069
1069
|
switch (this.state) {
|
|
@@ -1606,14 +1606,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
|
|
1606
1606
|
if (id.name === "arguments") {
|
|
1607
1607
|
return false;
|
|
1608
1608
|
}
|
|
1609
|
-
if (isReferenced(id, parent)) {
|
|
1609
|
+
if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
|
|
1610
1610
|
return true;
|
|
1611
1611
|
}
|
|
1612
1612
|
switch (parent.type) {
|
|
1613
1613
|
case "AssignmentExpression":
|
|
1614
1614
|
case "AssignmentPattern":
|
|
1615
1615
|
return true;
|
|
1616
|
-
case "
|
|
1616
|
+
case "ObjectProperty":
|
|
1617
|
+
return parent.key !== id && isInDestructureAssignment(parent, parentStack);
|
|
1617
1618
|
case "ArrayPattern":
|
|
1618
1619
|
return isInDestructureAssignment(parent, parentStack);
|
|
1619
1620
|
}
|
|
@@ -1782,7 +1783,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
1782
1783
|
if (parent.key === node) {
|
|
1783
1784
|
return !!parent.computed;
|
|
1784
1785
|
}
|
|
1785
|
-
return
|
|
1786
|
+
return !grandparent || grandparent.type !== "ObjectPattern";
|
|
1786
1787
|
// no: class { NODE = value; }
|
|
1787
1788
|
// yes: class { [NODE] = value; }
|
|
1788
1789
|
// yes: class { key = NODE; }
|
|
@@ -1832,6 +1833,9 @@ function isReferenced(node, parent, grandparent) {
|
|
|
1832
1833
|
// yes: export { NODE as foo };
|
|
1833
1834
|
// no: export { NODE as foo } from "foo";
|
|
1834
1835
|
case "ExportSpecifier":
|
|
1836
|
+
if (grandparent == null ? void 0 : grandparent.source) {
|
|
1837
|
+
return false;
|
|
1838
|
+
}
|
|
1835
1839
|
return parent.local === node;
|
|
1836
1840
|
// no: import NODE from "foo";
|
|
1837
1841
|
// no: import * as NODE from "foo";
|
|
@@ -1912,7 +1916,7 @@ function isCoreComponent(tag) {
|
|
|
1912
1916
|
return BASE_TRANSITION;
|
|
1913
1917
|
}
|
|
1914
1918
|
}
|
|
1915
|
-
const nonIdentifierRE =
|
|
1919
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1916
1920
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1917
1921
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1918
1922
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -2077,6 +2081,9 @@ function hasDynamicKeyVBind(node) {
|
|
|
2077
2081
|
function isText$1(node) {
|
|
2078
2082
|
return node.type === 5 || node.type === 2;
|
|
2079
2083
|
}
|
|
2084
|
+
function isVPre(p) {
|
|
2085
|
+
return p.type === 7 && p.name === "pre";
|
|
2086
|
+
}
|
|
2080
2087
|
function isVSlot(p) {
|
|
2081
2088
|
return p.type === 7 && p.name === "slot";
|
|
2082
2089
|
}
|
|
@@ -2375,7 +2382,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2375
2382
|
ondirarg(start, end) {
|
|
2376
2383
|
if (start === end) return;
|
|
2377
2384
|
const arg = getSlice(start, end);
|
|
2378
|
-
if (inVPre) {
|
|
2385
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2379
2386
|
currentProp.name += arg;
|
|
2380
2387
|
setLocEnd(currentProp.nameLoc, end);
|
|
2381
2388
|
} else {
|
|
@@ -2390,7 +2397,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2390
2397
|
},
|
|
2391
2398
|
ondirmodifier(start, end) {
|
|
2392
2399
|
const mod = getSlice(start, end);
|
|
2393
|
-
if (inVPre) {
|
|
2400
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2394
2401
|
currentProp.name += "." + mod;
|
|
2395
2402
|
setLocEnd(currentProp.nameLoc, end);
|
|
2396
2403
|
} else if (currentProp.name === "slot") {
|
|
@@ -2813,7 +2820,7 @@ function isUpperCase(c) {
|
|
|
2813
2820
|
return c > 64 && c < 91;
|
|
2814
2821
|
}
|
|
2815
2822
|
const windowsNewlineRE = /\r\n/g;
|
|
2816
|
-
function condenseWhitespace(nodes
|
|
2823
|
+
function condenseWhitespace(nodes) {
|
|
2817
2824
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2818
2825
|
let removedWhitespace = false;
|
|
2819
2826
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2999,12 +3006,12 @@ function cacheStatic(root, context) {
|
|
|
2999
3006
|
context,
|
|
3000
3007
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
3001
3008
|
// fallthrough attributes.
|
|
3002
|
-
|
|
3009
|
+
!!getSingleElementRoot(root)
|
|
3003
3010
|
);
|
|
3004
3011
|
}
|
|
3005
|
-
function
|
|
3006
|
-
const
|
|
3007
|
-
return children.length === 1 &&
|
|
3012
|
+
function getSingleElementRoot(root) {
|
|
3013
|
+
const children = root.children.filter((x) => x.type !== 3);
|
|
3014
|
+
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
|
3008
3015
|
}
|
|
3009
3016
|
function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
3010
3017
|
const { children } = node;
|
|
@@ -3037,6 +3044,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
3037
3044
|
} else if (child.type === 12) {
|
|
3038
3045
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
3039
3046
|
if (constantType >= 2) {
|
|
3047
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
3048
|
+
child.codegenNode.arguments.push(
|
|
3049
|
+
-1 + (` /* ${shared.PatchFlagNames[-1]} */` )
|
|
3050
|
+
);
|
|
3051
|
+
}
|
|
3040
3052
|
toCache.push(child);
|
|
3041
3053
|
continue;
|
|
3042
3054
|
}
|
|
@@ -3498,15 +3510,15 @@ function createRootCodegen(root, context) {
|
|
|
3498
3510
|
const { helper } = context;
|
|
3499
3511
|
const { children } = root;
|
|
3500
3512
|
if (children.length === 1) {
|
|
3501
|
-
const
|
|
3502
|
-
if (
|
|
3503
|
-
const codegenNode =
|
|
3513
|
+
const singleElementRootChild = getSingleElementRoot(root);
|
|
3514
|
+
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
|
3515
|
+
const codegenNode = singleElementRootChild.codegenNode;
|
|
3504
3516
|
if (codegenNode.type === 13) {
|
|
3505
3517
|
convertToBlock(codegenNode, context);
|
|
3506
3518
|
}
|
|
3507
3519
|
root.codegenNode = codegenNode;
|
|
3508
3520
|
} else {
|
|
3509
|
-
root.codegenNode =
|
|
3521
|
+
root.codegenNode = children[0];
|
|
3510
3522
|
}
|
|
3511
3523
|
} else if (children.length > 1) {
|
|
3512
3524
|
let patchFlag = 64;
|
|
@@ -4877,7 +4889,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
4877
4889
|
arg.children.unshift(`(`);
|
|
4878
4890
|
arg.children.push(`) || ""`);
|
|
4879
4891
|
} else if (!arg.isStatic) {
|
|
4880
|
-
arg.content = `${arg.content} || ""`;
|
|
4892
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4881
4893
|
}
|
|
4882
4894
|
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4883
4895
|
if (arg.type === 4) {
|
|
@@ -5290,7 +5302,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5290
5302
|
let prev;
|
|
5291
5303
|
while (j--) {
|
|
5292
5304
|
prev = children[j];
|
|
5293
|
-
if (prev.type !== 3) {
|
|
5305
|
+
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
|
5294
5306
|
break;
|
|
5295
5307
|
}
|
|
5296
5308
|
}
|
|
@@ -6801,6 +6813,7 @@ exports.isStaticProperty = isStaticProperty;
|
|
|
6801
6813
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
|
6802
6814
|
exports.isTemplateNode = isTemplateNode;
|
|
6803
6815
|
exports.isText = isText$1;
|
|
6816
|
+
exports.isVPre = isVPre;
|
|
6804
6817
|
exports.isVSlot = isVSlot;
|
|
6805
6818
|
exports.locStub = locStub;
|
|
6806
6819
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.5.
|
|
2
|
+
* @vue/compiler-core v3.5.18
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1063,7 +1063,7 @@ class Tokenizer {
|
|
|
1063
1063
|
this.buffer = input;
|
|
1064
1064
|
while (this.index < this.buffer.length) {
|
|
1065
1065
|
const c = this.buffer.charCodeAt(this.index);
|
|
1066
|
-
if (c === 10) {
|
|
1066
|
+
if (c === 10 && this.state !== 33) {
|
|
1067
1067
|
this.newlines.push(this.index);
|
|
1068
1068
|
}
|
|
1069
1069
|
switch (this.state) {
|
|
@@ -1602,14 +1602,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
|
|
|
1602
1602
|
if (id.name === "arguments") {
|
|
1603
1603
|
return false;
|
|
1604
1604
|
}
|
|
1605
|
-
if (isReferenced(id, parent)) {
|
|
1605
|
+
if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
|
|
1606
1606
|
return true;
|
|
1607
1607
|
}
|
|
1608
1608
|
switch (parent.type) {
|
|
1609
1609
|
case "AssignmentExpression":
|
|
1610
1610
|
case "AssignmentPattern":
|
|
1611
1611
|
return true;
|
|
1612
|
-
case "
|
|
1612
|
+
case "ObjectProperty":
|
|
1613
|
+
return parent.key !== id && isInDestructureAssignment(parent, parentStack);
|
|
1613
1614
|
case "ArrayPattern":
|
|
1614
1615
|
return isInDestructureAssignment(parent, parentStack);
|
|
1615
1616
|
}
|
|
@@ -1778,7 +1779,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
1778
1779
|
if (parent.key === node) {
|
|
1779
1780
|
return !!parent.computed;
|
|
1780
1781
|
}
|
|
1781
|
-
return
|
|
1782
|
+
return !grandparent || grandparent.type !== "ObjectPattern";
|
|
1782
1783
|
// no: class { NODE = value; }
|
|
1783
1784
|
// yes: class { [NODE] = value; }
|
|
1784
1785
|
// yes: class { key = NODE; }
|
|
@@ -1828,6 +1829,9 @@ function isReferenced(node, parent, grandparent) {
|
|
|
1828
1829
|
// yes: export { NODE as foo };
|
|
1829
1830
|
// no: export { NODE as foo } from "foo";
|
|
1830
1831
|
case "ExportSpecifier":
|
|
1832
|
+
if (grandparent == null ? void 0 : grandparent.source) {
|
|
1833
|
+
return false;
|
|
1834
|
+
}
|
|
1831
1835
|
return parent.local === node;
|
|
1832
1836
|
// no: import NODE from "foo";
|
|
1833
1837
|
// no: import * as NODE from "foo";
|
|
@@ -1908,7 +1912,7 @@ function isCoreComponent(tag) {
|
|
|
1908
1912
|
return BASE_TRANSITION;
|
|
1909
1913
|
}
|
|
1910
1914
|
}
|
|
1911
|
-
const nonIdentifierRE =
|
|
1915
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1912
1916
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1913
1917
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1914
1918
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -2073,6 +2077,9 @@ function hasDynamicKeyVBind(node) {
|
|
|
2073
2077
|
function isText$1(node) {
|
|
2074
2078
|
return node.type === 5 || node.type === 2;
|
|
2075
2079
|
}
|
|
2080
|
+
function isVPre(p) {
|
|
2081
|
+
return p.type === 7 && p.name === "pre";
|
|
2082
|
+
}
|
|
2076
2083
|
function isVSlot(p) {
|
|
2077
2084
|
return p.type === 7 && p.name === "slot";
|
|
2078
2085
|
}
|
|
@@ -2371,7 +2378,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2371
2378
|
ondirarg(start, end) {
|
|
2372
2379
|
if (start === end) return;
|
|
2373
2380
|
const arg = getSlice(start, end);
|
|
2374
|
-
if (inVPre) {
|
|
2381
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2375
2382
|
currentProp.name += arg;
|
|
2376
2383
|
setLocEnd(currentProp.nameLoc, end);
|
|
2377
2384
|
} else {
|
|
@@ -2386,7 +2393,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2386
2393
|
},
|
|
2387
2394
|
ondirmodifier(start, end) {
|
|
2388
2395
|
const mod = getSlice(start, end);
|
|
2389
|
-
if (inVPre) {
|
|
2396
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2390
2397
|
currentProp.name += "." + mod;
|
|
2391
2398
|
setLocEnd(currentProp.nameLoc, end);
|
|
2392
2399
|
} else if (currentProp.name === "slot") {
|
|
@@ -2779,7 +2786,7 @@ function isUpperCase(c) {
|
|
|
2779
2786
|
return c > 64 && c < 91;
|
|
2780
2787
|
}
|
|
2781
2788
|
const windowsNewlineRE = /\r\n/g;
|
|
2782
|
-
function condenseWhitespace(nodes
|
|
2789
|
+
function condenseWhitespace(nodes) {
|
|
2783
2790
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2784
2791
|
let removedWhitespace = false;
|
|
2785
2792
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2958,12 +2965,12 @@ function cacheStatic(root, context) {
|
|
|
2958
2965
|
context,
|
|
2959
2966
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
2960
2967
|
// fallthrough attributes.
|
|
2961
|
-
|
|
2968
|
+
!!getSingleElementRoot(root)
|
|
2962
2969
|
);
|
|
2963
2970
|
}
|
|
2964
|
-
function
|
|
2965
|
-
const
|
|
2966
|
-
return children.length === 1 &&
|
|
2971
|
+
function getSingleElementRoot(root) {
|
|
2972
|
+
const children = root.children.filter((x) => x.type !== 3);
|
|
2973
|
+
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
|
2967
2974
|
}
|
|
2968
2975
|
function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
2969
2976
|
const { children } = node;
|
|
@@ -2996,6 +3003,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2996
3003
|
} else if (child.type === 12) {
|
|
2997
3004
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2998
3005
|
if (constantType >= 2) {
|
|
3006
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
3007
|
+
child.codegenNode.arguments.push(
|
|
3008
|
+
-1 + (``)
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
2999
3011
|
toCache.push(child);
|
|
3000
3012
|
continue;
|
|
3001
3013
|
}
|
|
@@ -3443,15 +3455,15 @@ function createRootCodegen(root, context) {
|
|
|
3443
3455
|
const { helper } = context;
|
|
3444
3456
|
const { children } = root;
|
|
3445
3457
|
if (children.length === 1) {
|
|
3446
|
-
const
|
|
3447
|
-
if (
|
|
3448
|
-
const codegenNode =
|
|
3458
|
+
const singleElementRootChild = getSingleElementRoot(root);
|
|
3459
|
+
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
|
3460
|
+
const codegenNode = singleElementRootChild.codegenNode;
|
|
3449
3461
|
if (codegenNode.type === 13) {
|
|
3450
3462
|
convertToBlock(codegenNode, context);
|
|
3451
3463
|
}
|
|
3452
3464
|
root.codegenNode = codegenNode;
|
|
3453
3465
|
} else {
|
|
3454
|
-
root.codegenNode =
|
|
3466
|
+
root.codegenNode = children[0];
|
|
3455
3467
|
}
|
|
3456
3468
|
} else if (children.length > 1) {
|
|
3457
3469
|
let patchFlag = 64;
|
|
@@ -4792,7 +4804,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
4792
4804
|
arg.children.unshift(`(`);
|
|
4793
4805
|
arg.children.push(`) || ""`);
|
|
4794
4806
|
} else if (!arg.isStatic) {
|
|
4795
|
-
arg.content = `${arg.content} || ""`;
|
|
4807
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4796
4808
|
}
|
|
4797
4809
|
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4798
4810
|
if (arg.type === 4) {
|
|
@@ -5205,7 +5217,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5205
5217
|
let prev;
|
|
5206
5218
|
while (j--) {
|
|
5207
5219
|
prev = children[j];
|
|
5208
|
-
if (prev.type !== 3) {
|
|
5220
|
+
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
|
5209
5221
|
break;
|
|
5210
5222
|
}
|
|
5211
5223
|
}
|
|
@@ -6678,6 +6690,7 @@ exports.isStaticProperty = isStaticProperty;
|
|
|
6678
6690
|
exports.isStaticPropertyKey = isStaticPropertyKey;
|
|
6679
6691
|
exports.isTemplateNode = isTemplateNode;
|
|
6680
6692
|
exports.isText = isText$1;
|
|
6693
|
+
exports.isVPre = isVPre;
|
|
6681
6694
|
exports.isVSlot = isVSlot;
|
|
6682
6695
|
exports.locStub = locStub;
|
|
6683
6696
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1031,6 +1031,7 @@ export declare function findProp(node: ElementNode, name: string, dynamicOnly?:
|
|
|
1031
1031
|
export declare function isStaticArgOf(arg: DirectiveNode['arg'], name: string): boolean;
|
|
1032
1032
|
export declare function hasDynamicKeyVBind(node: ElementNode): boolean;
|
|
1033
1033
|
export declare function isText(node: TemplateChildNode): node is TextNode | InterpolationNode;
|
|
1034
|
+
export declare function isVPre(p: ElementNode['props'][0]): p is DirectiveNode;
|
|
1034
1035
|
export declare function isVSlot(p: ElementNode['props'][0]): p is DirectiveNode;
|
|
1035
1036
|
export declare function isTemplateNode(node: RootNode | TemplateChildNode): node is TemplateNode;
|
|
1036
1037
|
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.5.
|
|
2
|
+
* @vue/compiler-core v3.5.18
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { isString, NOOP, isObject, extend, NO, isSymbol, isArray, capitalize, camelize, EMPTY_OBJ,
|
|
6
|
+
import { isString, NOOP, isObject, extend, NO, isSymbol, PatchFlagNames, isArray, capitalize, camelize, EMPTY_OBJ, slotFlagsText, isOn, isBuiltInDirective, isReservedProp, toHandlerKey } from '@vue/shared';
|
|
7
7
|
export { generateCodeFrame } from '@vue/shared';
|
|
8
8
|
|
|
9
9
|
const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
|
|
@@ -1023,7 +1023,7 @@ class Tokenizer {
|
|
|
1023
1023
|
this.buffer = input;
|
|
1024
1024
|
while (this.index < this.buffer.length) {
|
|
1025
1025
|
const c = this.buffer.charCodeAt(this.index);
|
|
1026
|
-
if (c === 10) {
|
|
1026
|
+
if (c === 10 && this.state !== 33) {
|
|
1027
1027
|
this.newlines.push(this.index);
|
|
1028
1028
|
}
|
|
1029
1029
|
switch (this.state) {
|
|
@@ -1535,7 +1535,7 @@ function isForStatement(stmt) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
function walkForStatement(stmt, isVar, onIdent) {
|
|
1537
1537
|
const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
|
|
1538
|
-
if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar :
|
|
1538
|
+
if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : !isVar)) {
|
|
1539
1539
|
for (const decl of variable.declarations) {
|
|
1540
1540
|
for (const id of extractIdentifiers(decl.id)) {
|
|
1541
1541
|
onIdent(id);
|
|
@@ -1620,7 +1620,7 @@ function isCoreComponent(tag) {
|
|
|
1620
1620
|
return BASE_TRANSITION;
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
|
-
const nonIdentifierRE =
|
|
1623
|
+
const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
|
|
1624
1624
|
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
1625
1625
|
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
1626
1626
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
@@ -1759,6 +1759,9 @@ function hasDynamicKeyVBind(node) {
|
|
|
1759
1759
|
function isText$1(node) {
|
|
1760
1760
|
return node.type === 5 || node.type === 2;
|
|
1761
1761
|
}
|
|
1762
|
+
function isVPre(p) {
|
|
1763
|
+
return p.type === 7 && p.name === "pre";
|
|
1764
|
+
}
|
|
1762
1765
|
function isVSlot(p) {
|
|
1763
1766
|
return p.type === 7 && p.name === "slot";
|
|
1764
1767
|
}
|
|
@@ -2058,7 +2061,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2058
2061
|
ondirarg(start, end) {
|
|
2059
2062
|
if (start === end) return;
|
|
2060
2063
|
const arg = getSlice(start, end);
|
|
2061
|
-
if (inVPre) {
|
|
2064
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2062
2065
|
currentProp.name += arg;
|
|
2063
2066
|
setLocEnd(currentProp.nameLoc, end);
|
|
2064
2067
|
} else {
|
|
@@ -2073,7 +2076,7 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2073
2076
|
},
|
|
2074
2077
|
ondirmodifier(start, end) {
|
|
2075
2078
|
const mod = getSlice(start, end);
|
|
2076
|
-
if (inVPre) {
|
|
2079
|
+
if (inVPre && !isVPre(currentProp)) {
|
|
2077
2080
|
currentProp.name += "." + mod;
|
|
2078
2081
|
setLocEnd(currentProp.nameLoc, end);
|
|
2079
2082
|
} else if (currentProp.name === "slot") {
|
|
@@ -2499,7 +2502,7 @@ function isUpperCase(c) {
|
|
|
2499
2502
|
return c > 64 && c < 91;
|
|
2500
2503
|
}
|
|
2501
2504
|
const windowsNewlineRE = /\r\n/g;
|
|
2502
|
-
function condenseWhitespace(nodes
|
|
2505
|
+
function condenseWhitespace(nodes) {
|
|
2503
2506
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2504
2507
|
let removedWhitespace = false;
|
|
2505
2508
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2663,12 +2666,12 @@ function cacheStatic(root, context) {
|
|
|
2663
2666
|
context,
|
|
2664
2667
|
// Root node is unfortunately non-hoistable due to potential parent
|
|
2665
2668
|
// fallthrough attributes.
|
|
2666
|
-
|
|
2669
|
+
!!getSingleElementRoot(root)
|
|
2667
2670
|
);
|
|
2668
2671
|
}
|
|
2669
|
-
function
|
|
2670
|
-
const
|
|
2671
|
-
return children.length === 1 &&
|
|
2672
|
+
function getSingleElementRoot(root) {
|
|
2673
|
+
const children = root.children.filter((x) => x.type !== 3);
|
|
2674
|
+
return children.length === 1 && children[0].type === 1 && !isSlotOutlet(children[0]) ? children[0] : null;
|
|
2672
2675
|
}
|
|
2673
2676
|
function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
2674
2677
|
const { children } = node;
|
|
@@ -2701,6 +2704,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
|
|
|
2701
2704
|
} else if (child.type === 12) {
|
|
2702
2705
|
const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
|
|
2703
2706
|
if (constantType >= 2) {
|
|
2707
|
+
if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
|
|
2708
|
+
child.codegenNode.arguments.push(
|
|
2709
|
+
-1 + (!!(process.env.NODE_ENV !== "production") ? ` /* ${PatchFlagNames[-1]} */` : ``)
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2704
2712
|
toCache.push(child);
|
|
2705
2713
|
continue;
|
|
2706
2714
|
}
|
|
@@ -3135,15 +3143,15 @@ function createRootCodegen(root, context) {
|
|
|
3135
3143
|
const { helper } = context;
|
|
3136
3144
|
const { children } = root;
|
|
3137
3145
|
if (children.length === 1) {
|
|
3138
|
-
const
|
|
3139
|
-
if (
|
|
3140
|
-
const codegenNode =
|
|
3146
|
+
const singleElementRootChild = getSingleElementRoot(root);
|
|
3147
|
+
if (singleElementRootChild && singleElementRootChild.codegenNode) {
|
|
3148
|
+
const codegenNode = singleElementRootChild.codegenNode;
|
|
3141
3149
|
if (codegenNode.type === 13) {
|
|
3142
3150
|
convertToBlock(codegenNode, context);
|
|
3143
3151
|
}
|
|
3144
3152
|
root.codegenNode = codegenNode;
|
|
3145
3153
|
} else {
|
|
3146
|
-
root.codegenNode =
|
|
3154
|
+
root.codegenNode = children[0];
|
|
3147
3155
|
}
|
|
3148
3156
|
} else if (children.length > 1) {
|
|
3149
3157
|
let patchFlag = 64;
|
|
@@ -4162,7 +4170,7 @@ const transformBind = (dir, _node, context) => {
|
|
|
4162
4170
|
arg.children.unshift(`(`);
|
|
4163
4171
|
arg.children.push(`) || ""`);
|
|
4164
4172
|
} else if (!arg.isStatic) {
|
|
4165
|
-
arg.content = `${arg.content} || ""`;
|
|
4173
|
+
arg.content = arg.content ? `${arg.content} || ""` : `""`;
|
|
4166
4174
|
}
|
|
4167
4175
|
if (modifiers.some((mod) => mod.content === "camel")) {
|
|
4168
4176
|
if (arg.type === 4) {
|
|
@@ -4528,7 +4536,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4528
4536
|
let prev;
|
|
4529
4537
|
while (j--) {
|
|
4530
4538
|
prev = children[j];
|
|
4531
|
-
if (prev.type !== 3) {
|
|
4539
|
+
if (prev.type !== 3 && isNonWhitespaceContent(prev)) {
|
|
4532
4540
|
break;
|
|
4533
4541
|
}
|
|
4534
4542
|
}
|
|
@@ -5799,4 +5807,4 @@ const BindingTypes = {
|
|
|
5799
5807
|
|
|
5800
5808
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
5801
5809
|
|
|
5802
|
-
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
|
5810
|
+
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, Namespaces, NodeTypes, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVPre, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, unwrapTSNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.18",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/parser": "^7.
|
|
49
|
+
"@babel/parser": "^7.28.0",
|
|
50
50
|
"entities": "^4.5.0",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.1",
|
|
53
|
-
"@vue/shared": "3.5.
|
|
53
|
+
"@vue/shared": "3.5.18"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.
|
|
56
|
+
"@babel/types": "^7.28.1"
|
|
57
57
|
}
|
|
58
58
|
}
|