@vue/compiler-sfc 3.6.0-beta.2 → 3.6.0-beta.3
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-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -21817,7 +21817,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
21817
21817
|
return generator.toJSON();
|
|
21818
21818
|
}
|
|
21819
21819
|
|
|
21820
|
-
const version = "3.6.0-beta.
|
|
21820
|
+
const version = "3.6.0-beta.3";
|
|
21821
21821
|
const parseCache = parseCache$1;
|
|
21822
21822
|
const errorMessages = {
|
|
21823
21823
|
...CompilerDOM.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -32201,7 +32201,29 @@ const newBlock = (node) => ({
|
|
|
32201
32201
|
});
|
|
32202
32202
|
function wrapTemplate(node, dirs) {
|
|
32203
32203
|
if (node.tagType === 3) {
|
|
32204
|
-
|
|
32204
|
+
const otherStructuralDirs = ["if", "else-if", "else", "for"];
|
|
32205
|
+
const hasOtherStructuralDir = node.props.some(
|
|
32206
|
+
(prop) => prop.type === 7 && otherStructuralDirs.includes(prop.name) && !dirs.includes(prop.name)
|
|
32207
|
+
);
|
|
32208
|
+
if (!hasOtherStructuralDir) {
|
|
32209
|
+
return node;
|
|
32210
|
+
}
|
|
32211
|
+
const reserved2 = [];
|
|
32212
|
+
const pass2 = [];
|
|
32213
|
+
node.props.forEach((prop) => {
|
|
32214
|
+
if (prop.type === 7 && dirs.includes(prop.name)) {
|
|
32215
|
+
reserved2.push(prop);
|
|
32216
|
+
} else {
|
|
32217
|
+
pass2.push(prop);
|
|
32218
|
+
}
|
|
32219
|
+
});
|
|
32220
|
+
return extend({}, node, {
|
|
32221
|
+
type: 1,
|
|
32222
|
+
tag: "template",
|
|
32223
|
+
props: reserved2,
|
|
32224
|
+
tagType: 3,
|
|
32225
|
+
children: [extend({}, node, { props: pass2 })]
|
|
32226
|
+
});
|
|
32205
32227
|
}
|
|
32206
32228
|
const reserved = [];
|
|
32207
32229
|
const pass = [];
|
|
@@ -32280,10 +32302,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
32280
32302
|
}
|
|
32281
32303
|
return exp.isStatic ? exp.content : null;
|
|
32282
32304
|
}
|
|
32283
|
-
function isInTransition(context) {
|
|
32284
|
-
const parentNode = context.parent && context.parent.node;
|
|
32285
|
-
return !!(parentNode && isTransitionNode(parentNode));
|
|
32286
|
-
}
|
|
32287
32305
|
function isTransitionNode(node) {
|
|
32288
32306
|
return node.type === 1 && isTransitionTag(node.tag);
|
|
32289
32307
|
}
|
|
@@ -32734,14 +32752,12 @@ const IRNodeTypes = {
|
|
|
32734
32752
|
"12": "SLOT_OUTLET_NODE",
|
|
32735
32753
|
"DIRECTIVE": 13,
|
|
32736
32754
|
"13": "DIRECTIVE",
|
|
32737
|
-
"
|
|
32738
|
-
"14": "
|
|
32739
|
-
"
|
|
32740
|
-
"15": "
|
|
32741
|
-
"
|
|
32742
|
-
"16": "
|
|
32743
|
-
"GET_TEXT_CHILD": 17,
|
|
32744
|
-
"17": "GET_TEXT_CHILD"
|
|
32755
|
+
"IF": 14,
|
|
32756
|
+
"14": "IF",
|
|
32757
|
+
"FOR": 15,
|
|
32758
|
+
"15": "FOR",
|
|
32759
|
+
"GET_TEXT_CHILD": 16,
|
|
32760
|
+
"16": "GET_TEXT_CHILD"
|
|
32745
32761
|
};
|
|
32746
32762
|
const DynamicFlag = {
|
|
32747
32763
|
"NONE": 0,
|
|
@@ -32755,7 +32771,7 @@ const DynamicFlag = {
|
|
|
32755
32771
|
};
|
|
32756
32772
|
function isBlockOperation(op) {
|
|
32757
32773
|
const type = op.type;
|
|
32758
|
-
return type === 11 || type === 12 || type ===
|
|
32774
|
+
return type === 11 || type === 12 || type === 14 || type === 15;
|
|
32759
32775
|
}
|
|
32760
32776
|
|
|
32761
32777
|
function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
@@ -33906,21 +33922,16 @@ function genSetTemplateRef(oper, context) {
|
|
|
33906
33922
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
33907
33923
|
return [
|
|
33908
33924
|
NEWLINE,
|
|
33909
|
-
oper.effect && `r${oper.element} = `,
|
|
33910
33925
|
...genCall(
|
|
33911
33926
|
setTemplateRefIdent,
|
|
33912
33927
|
// will be generated in root scope
|
|
33913
33928
|
`n${oper.element}`,
|
|
33914
33929
|
refValue,
|
|
33915
|
-
oper.effect ? `r${oper.element}` : oper.refFor ? "void 0" : void 0,
|
|
33916
33930
|
oper.refFor && "true",
|
|
33917
33931
|
refKey
|
|
33918
33932
|
)
|
|
33919
33933
|
];
|
|
33920
33934
|
}
|
|
33921
|
-
function genDeclareOldRef(oper) {
|
|
33922
|
-
return [NEWLINE, `let r${oper.id}`];
|
|
33923
|
-
}
|
|
33924
33935
|
function genRefValue(value, context) {
|
|
33925
33936
|
if (value && context.options.inline) {
|
|
33926
33937
|
const binding = context.options.bindingMetadata[value.content];
|
|
@@ -34308,15 +34319,7 @@ function genDynamicProps(props, context) {
|
|
|
34308
34319
|
}
|
|
34309
34320
|
} else {
|
|
34310
34321
|
expr = genExpression(p.value, context);
|
|
34311
|
-
if (p.handler)
|
|
34312
|
-
expr = genCall(
|
|
34313
|
-
helper("toHandlers"),
|
|
34314
|
-
expr,
|
|
34315
|
-
`false`,
|
|
34316
|
-
// preserveCaseIfNecessary: false, not needed for component
|
|
34317
|
-
`true`
|
|
34318
|
-
// wrap handler values in functions
|
|
34319
|
-
);
|
|
34322
|
+
if (p.handler) expr = genCall(helper("toHandlers"), expr);
|
|
34320
34323
|
}
|
|
34321
34324
|
}
|
|
34322
34325
|
frags.push(["() => (", ...expr, ")"]);
|
|
@@ -34510,10 +34513,10 @@ function hasComponentOrSlotInDynamic(dynamic) {
|
|
|
34510
34513
|
if (type === 11 || type === 12) {
|
|
34511
34514
|
return true;
|
|
34512
34515
|
}
|
|
34513
|
-
if (type ===
|
|
34516
|
+
if (type === 14) {
|
|
34514
34517
|
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
34515
34518
|
}
|
|
34516
|
-
if (type ===
|
|
34519
|
+
if (type === 15) {
|
|
34517
34520
|
if (hasComponentOrSlotInBlock(dynamic.operation.render))
|
|
34518
34521
|
return true;
|
|
34519
34522
|
}
|
|
@@ -34529,10 +34532,10 @@ function hasComponentOrSlotInOperations(operations) {
|
|
|
34529
34532
|
case 11:
|
|
34530
34533
|
case 12:
|
|
34531
34534
|
return true;
|
|
34532
|
-
case
|
|
34535
|
+
case 14:
|
|
34533
34536
|
if (hasComponentOrSlotInIf(op)) return true;
|
|
34534
34537
|
break;
|
|
34535
|
-
case
|
|
34538
|
+
case 15:
|
|
34536
34539
|
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
34537
34540
|
break;
|
|
34538
34541
|
}
|
|
@@ -34612,19 +34615,17 @@ function genOperation(oper, context) {
|
|
|
34612
34615
|
return genInsertNode(oper, context);
|
|
34613
34616
|
case 10:
|
|
34614
34617
|
return genPrependNode(oper, context);
|
|
34615
|
-
case
|
|
34618
|
+
case 14:
|
|
34616
34619
|
return genIf(oper, context);
|
|
34617
|
-
case
|
|
34620
|
+
case 15:
|
|
34618
34621
|
return genFor(oper, context);
|
|
34619
34622
|
case 11:
|
|
34620
34623
|
return genCreateComponent(oper, context);
|
|
34621
|
-
case 14:
|
|
34622
|
-
return genDeclareOldRef(oper);
|
|
34623
34624
|
case 12:
|
|
34624
34625
|
return genSlotOutlet(oper, context);
|
|
34625
34626
|
case 13:
|
|
34626
34627
|
return genBuiltinDirective(oper, context);
|
|
34627
|
-
case
|
|
34628
|
+
case 16:
|
|
34628
34629
|
return genGetTextChild(oper, context);
|
|
34629
34630
|
default:
|
|
34630
34631
|
const exhaustiveCheck = oper;
|
|
@@ -34825,7 +34826,7 @@ function genBlock(oper, context, args = [], root) {
|
|
|
34825
34826
|
}
|
|
34826
34827
|
function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
34827
34828
|
const [frag, push] = buildCodeFragment();
|
|
34828
|
-
const { dynamic, effect, operation, returns
|
|
34829
|
+
const { dynamic, effect, operation, returns } = block;
|
|
34829
34830
|
const resetBlock = context.enterBlock(block);
|
|
34830
34831
|
if (root) {
|
|
34831
34832
|
for (let name of context.ir.component) {
|
|
@@ -34858,12 +34859,6 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
34858
34859
|
if (root && context.ir.hasDeferredVShow) {
|
|
34859
34860
|
push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`);
|
|
34860
34861
|
}
|
|
34861
|
-
if (dynamic.needsKey) {
|
|
34862
|
-
for (const child of dynamic.children) {
|
|
34863
|
-
const keyValue = key ? genExpression(key, context) : JSON.stringify(child.id);
|
|
34864
|
-
push(NEWLINE, `n${child.id}.$key = `, ...keyValue);
|
|
34865
|
-
}
|
|
34866
|
-
}
|
|
34867
34862
|
push(NEWLINE, `return `);
|
|
34868
34863
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
34869
34864
|
const returnsCode = returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "null"];
|
|
@@ -35576,7 +35571,7 @@ const transformVText = (dir, node, context) => {
|
|
|
35576
35571
|
const isComponent = node.tagType === 1;
|
|
35577
35572
|
if (!isComponent) {
|
|
35578
35573
|
context.registerOperation({
|
|
35579
|
-
type:
|
|
35574
|
+
type: 16,
|
|
35580
35575
|
parent: context.reference()
|
|
35581
35576
|
});
|
|
35582
35577
|
}
|
|
@@ -35753,10 +35748,6 @@ const transformTemplateRef = (node, context) => {
|
|
|
35753
35748
|
return () => {
|
|
35754
35749
|
const id = context.reference();
|
|
35755
35750
|
const effect = !isConstantExpression(value);
|
|
35756
|
-
effect && context.registerOperation({
|
|
35757
|
-
type: 14,
|
|
35758
|
-
id
|
|
35759
|
-
});
|
|
35760
35751
|
context.registerEffect([value], {
|
|
35761
35752
|
type: 8,
|
|
35762
35753
|
element: id,
|
|
@@ -35841,7 +35832,7 @@ function processTextContainer(children, context) {
|
|
|
35841
35832
|
} else {
|
|
35842
35833
|
context.childrenTemplate = [" "];
|
|
35843
35834
|
context.registerOperation({
|
|
35844
|
-
type:
|
|
35835
|
+
type: 16,
|
|
35845
35836
|
parent: context.reference()
|
|
35846
35837
|
});
|
|
35847
35838
|
context.registerEffect(values, {
|
|
@@ -36030,7 +36021,7 @@ function processIf(node, dir, context) {
|
|
|
36030
36021
|
return () => {
|
|
36031
36022
|
onExit();
|
|
36032
36023
|
context.dynamic.operation = {
|
|
36033
|
-
type:
|
|
36024
|
+
type: 14,
|
|
36034
36025
|
id,
|
|
36035
36026
|
condition: dir.exp,
|
|
36036
36027
|
positive: branch,
|
|
@@ -36045,7 +36036,7 @@ function processIf(node, dir, context) {
|
|
|
36045
36036
|
if (siblings) {
|
|
36046
36037
|
let i = siblings.length;
|
|
36047
36038
|
while (i--) {
|
|
36048
|
-
if (siblings[i].operation && siblings[i].operation.type ===
|
|
36039
|
+
if (siblings[i].operation && siblings[i].operation.type === 14) {
|
|
36049
36040
|
lastIfNode = siblings[i].operation;
|
|
36050
36041
|
break;
|
|
36051
36042
|
}
|
|
@@ -36054,14 +36045,14 @@ function processIf(node, dir, context) {
|
|
|
36054
36045
|
if (
|
|
36055
36046
|
// check if v-if is the sibling node
|
|
36056
36047
|
!siblingIf || // check if IfNode is the last operation and get the root IfNode
|
|
36057
|
-
!lastIfNode || lastIfNode.type !==
|
|
36048
|
+
!lastIfNode || lastIfNode.type !== 14
|
|
36058
36049
|
) {
|
|
36059
36050
|
context.options.onError(
|
|
36060
36051
|
createCompilerError(30, node.loc)
|
|
36061
36052
|
);
|
|
36062
36053
|
return;
|
|
36063
36054
|
}
|
|
36064
|
-
while (lastIfNode.negative && lastIfNode.negative.type ===
|
|
36055
|
+
while (lastIfNode.negative && lastIfNode.negative.type === 14) {
|
|
36065
36056
|
lastIfNode = lastIfNode.negative;
|
|
36066
36057
|
}
|
|
36067
36058
|
if (dir.name === "else-if" && lastIfNode.negative) {
|
|
@@ -36081,7 +36072,7 @@ function processIf(node, dir, context) {
|
|
|
36081
36072
|
lastIfNode.negative = branch;
|
|
36082
36073
|
} else {
|
|
36083
36074
|
lastIfNode.negative = {
|
|
36084
|
-
type:
|
|
36075
|
+
type: 14,
|
|
36085
36076
|
id: -1,
|
|
36086
36077
|
condition: dir.exp,
|
|
36087
36078
|
positive: branch,
|
|
@@ -36096,7 +36087,6 @@ function createIfBranch(node, context) {
|
|
|
36096
36087
|
const branch = newBlock(node);
|
|
36097
36088
|
const exitBlock = context.enterBlock(branch);
|
|
36098
36089
|
context.reference();
|
|
36099
|
-
branch.dynamic.needsKey = isInTransition(context);
|
|
36100
36090
|
return [branch, exitBlock];
|
|
36101
36091
|
}
|
|
36102
36092
|
|
|
@@ -36134,7 +36124,7 @@ function processFor(node, dir, context) {
|
|
|
36134
36124
|
const { parent } = context;
|
|
36135
36125
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
36136
36126
|
context.dynamic.operation = {
|
|
36137
|
-
type:
|
|
36127
|
+
type: 15,
|
|
36138
36128
|
id,
|
|
36139
36129
|
source,
|
|
36140
36130
|
value,
|
|
@@ -36295,10 +36285,10 @@ function transformComponentSlot(node, dir, context) {
|
|
|
36295
36285
|
markNonTemplate(n, context);
|
|
36296
36286
|
});
|
|
36297
36287
|
}
|
|
36298
|
-
|
|
36288
|
+
const [block, onExit] = createSlotBlock(node, dir, context);
|
|
36299
36289
|
if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
|
|
36300
36290
|
const nonCommentChild = nonSlotTemplateChildren.find(
|
|
36301
|
-
(n) => n
|
|
36291
|
+
(n) => !isCommentOrWhitespace(n)
|
|
36302
36292
|
);
|
|
36303
36293
|
if (nonCommentChild) {
|
|
36304
36294
|
const keyProp = findProp(
|
|
@@ -36306,11 +36296,10 @@ function transformComponentSlot(node, dir, context) {
|
|
|
36306
36296
|
"key"
|
|
36307
36297
|
);
|
|
36308
36298
|
if (keyProp) {
|
|
36309
|
-
|
|
36299
|
+
block.key = keyProp.exp;
|
|
36310
36300
|
}
|
|
36311
36301
|
}
|
|
36312
36302
|
}
|
|
36313
|
-
const [block, onExit] = createSlotBlock(node, dir, context, slotKey);
|
|
36314
36303
|
const { slots } = context;
|
|
36315
36304
|
return () => {
|
|
36316
36305
|
onExit();
|
|
@@ -36444,13 +36433,9 @@ function hasStaticSlot(slots, name) {
|
|
|
36444
36433
|
if (slot.slotType === 0) return !!slot.slots[name];
|
|
36445
36434
|
});
|
|
36446
36435
|
}
|
|
36447
|
-
function createSlotBlock(slotNode, dir, context
|
|
36436
|
+
function createSlotBlock(slotNode, dir, context) {
|
|
36448
36437
|
const block = newBlock(slotNode);
|
|
36449
36438
|
block.props = dir && dir.exp;
|
|
36450
|
-
if (key) {
|
|
36451
|
-
block.key = key;
|
|
36452
|
-
block.dynamic.needsKey = true;
|
|
36453
|
-
}
|
|
36454
36439
|
const exitBlock = context.enterBlock(block);
|
|
36455
36440
|
return [block, exitBlock];
|
|
36456
36441
|
}
|
|
@@ -55402,7 +55387,7 @@ var __spreadValues = (a, b) => {
|
|
|
55402
55387
|
}
|
|
55403
55388
|
return a;
|
|
55404
55389
|
};
|
|
55405
|
-
const version = "3.6.0-beta.
|
|
55390
|
+
const version = "3.6.0-beta.3";
|
|
55406
55391
|
const parseCache = parseCache$1;
|
|
55407
55392
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
55408
55393
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.3",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"magic-string": "^0.30.21",
|
|
48
48
|
"postcss": "^8.5.6",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-
|
|
53
|
-
"@vue/
|
|
54
|
-
"@vue/
|
|
50
|
+
"@vue/compiler-core": "3.6.0-beta.3",
|
|
51
|
+
"@vue/compiler-ssr": "3.6.0-beta.3",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-beta.3",
|
|
53
|
+
"@vue/compiler-dom": "3.6.0-beta.3",
|
|
54
|
+
"@vue/shared": "3.6.0-beta.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.28.5",
|