@vue/compiler-sfc 3.6.0-beta.1 → 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 +4 -3
- package/dist/compiler-sfc.esm-browser.js +122 -79
- package/package.json +6 -6
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
|
**/
|
|
@@ -21523,7 +21523,8 @@ let __temp${any}, __restore${any}
|
|
|
21523
21523
|
if (preamble) {
|
|
21524
21524
|
ctx.s.prepend(preamble);
|
|
21525
21525
|
}
|
|
21526
|
-
if (helpers && helpers.has(CompilerDOM.UNREF)
|
|
21526
|
+
if (helpers && (helpers.has(CompilerDOM.UNREF) || // vapor compiler uses 'unref' instead of UNREF
|
|
21527
|
+
helpers.has("unref"))) {
|
|
21527
21528
|
ctx.helperImports.delete("unref");
|
|
21528
21529
|
}
|
|
21529
21530
|
returned = code;
|
|
@@ -21816,7 +21817,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
21816
21817
|
return generator.toJSON();
|
|
21817
21818
|
}
|
|
21818
21819
|
|
|
21819
|
-
const version = "3.6.0-beta.
|
|
21820
|
+
const version = "3.6.0-beta.3";
|
|
21820
21821
|
const parseCache = parseCache$1;
|
|
21821
21822
|
const errorMessages = {
|
|
21822
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
|
**/
|
|
@@ -221,10 +221,12 @@ const HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,asi
|
|
|
221
221
|
const SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
|
222
222
|
const MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
|
223
223
|
const VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
224
|
+
const FORMATTING_TAGS = "a,b,big,code,em,font,i,nobr,s,small,strike,strong,tt,u";
|
|
224
225
|
const isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
|
225
226
|
const isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
|
226
227
|
const isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
227
228
|
const isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
229
|
+
const isFormattingTag = /* @__PURE__ */ makeMap(FORMATTING_TAGS);
|
|
228
230
|
|
|
229
231
|
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
230
232
|
const isBooleanAttr = /* @__PURE__ */ makeMap(
|
|
@@ -19443,8 +19445,7 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
|
|
|
19443
19445
|
if (includeAll || isRefed && !isLocal) {
|
|
19444
19446
|
onIdentifier(node, parent, parentStack, isRefed, isLocal);
|
|
19445
19447
|
}
|
|
19446
|
-
} else if (node.type === "ObjectProperty" &&
|
|
19447
|
-
(parent == null ? void 0 : parent.type) === "ObjectPattern") {
|
|
19448
|
+
} else if (node.type === "ObjectProperty" && (parent == null ? void 0 : parent.type) === "ObjectPattern") {
|
|
19448
19449
|
node.inPattern = true;
|
|
19449
19450
|
} else if (isFunctionType(node)) {
|
|
19450
19451
|
if (node.scopeIds) {
|
|
@@ -32200,7 +32201,29 @@ const newBlock = (node) => ({
|
|
|
32200
32201
|
});
|
|
32201
32202
|
function wrapTemplate(node, dirs) {
|
|
32202
32203
|
if (node.tagType === 3) {
|
|
32203
|
-
|
|
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
|
+
});
|
|
32204
32227
|
}
|
|
32205
32228
|
const reserved = [];
|
|
32206
32229
|
const pass = [];
|
|
@@ -32279,10 +32302,6 @@ function getLiteralExpressionValue(exp, excludeNumber) {
|
|
|
32279
32302
|
}
|
|
32280
32303
|
return exp.isStatic ? exp.content : null;
|
|
32281
32304
|
}
|
|
32282
|
-
function isInTransition(context) {
|
|
32283
|
-
const parentNode = context.parent && context.parent.node;
|
|
32284
|
-
return !!(parentNode && isTransitionNode(parentNode));
|
|
32285
|
-
}
|
|
32286
32305
|
function isTransitionNode(node) {
|
|
32287
32306
|
return node.type === 1 && isTransitionTag(node.tag);
|
|
32288
32307
|
}
|
|
@@ -32321,6 +32340,8 @@ class TransformContext {
|
|
|
32321
32340
|
this.node = node;
|
|
32322
32341
|
this.selfName = null;
|
|
32323
32342
|
this.parent = null;
|
|
32343
|
+
// cached parent that skips template tags
|
|
32344
|
+
this.effectiveParent = null;
|
|
32324
32345
|
this.index = 0;
|
|
32325
32346
|
this.block = this.ir.block;
|
|
32326
32347
|
this.template = "";
|
|
@@ -32333,6 +32354,12 @@ class TransformContext {
|
|
|
32333
32354
|
this.component = this.ir.component;
|
|
32334
32355
|
this.directive = this.ir.directive;
|
|
32335
32356
|
this.slots = [];
|
|
32357
|
+
// whether this node is the last effective child of its parent
|
|
32358
|
+
// (all siblings after it are components, which don't appear in HTML template)
|
|
32359
|
+
this.isLastEffectiveChild = true;
|
|
32360
|
+
// whether this node is on the rightmost path of the tree
|
|
32361
|
+
// (all ancestors are also last effective children)
|
|
32362
|
+
this.isOnRightmostPath = true;
|
|
32336
32363
|
this.globalId = 0;
|
|
32337
32364
|
this.nextIdMap = null;
|
|
32338
32365
|
this.increaseId = () => {
|
|
@@ -32413,15 +32440,31 @@ class TransformContext {
|
|
|
32413
32440
|
this.block.operation.push(...node);
|
|
32414
32441
|
}
|
|
32415
32442
|
create(node, index) {
|
|
32443
|
+
let effectiveParent = this;
|
|
32444
|
+
while (effectiveParent && effectiveParent.node.type === 1 && effectiveParent.node.tagType === 3) {
|
|
32445
|
+
effectiveParent = effectiveParent.parent;
|
|
32446
|
+
}
|
|
32447
|
+
const isLastEffectiveChild = this.isEffectivelyLastChild(index);
|
|
32448
|
+
const isOnRightmostPath = this.isOnRightmostPath && isLastEffectiveChild;
|
|
32416
32449
|
return Object.assign(Object.create(TransformContext.prototype), this, {
|
|
32417
32450
|
node,
|
|
32418
32451
|
parent: this,
|
|
32419
32452
|
index,
|
|
32420
32453
|
template: "",
|
|
32421
32454
|
childrenTemplate: [],
|
|
32422
|
-
dynamic: newDynamic()
|
|
32455
|
+
dynamic: newDynamic(),
|
|
32456
|
+
effectiveParent,
|
|
32457
|
+
isLastEffectiveChild,
|
|
32458
|
+
isOnRightmostPath
|
|
32423
32459
|
});
|
|
32424
32460
|
}
|
|
32461
|
+
isEffectivelyLastChild(index) {
|
|
32462
|
+
const children = this.node.children;
|
|
32463
|
+
if (!children) return true;
|
|
32464
|
+
return children.every(
|
|
32465
|
+
(c, i) => i <= index || c.type === 1 && c.tagType === 1
|
|
32466
|
+
);
|
|
32467
|
+
}
|
|
32425
32468
|
}
|
|
32426
32469
|
const defaultOptions = {
|
|
32427
32470
|
filename: "",
|
|
@@ -32709,14 +32752,12 @@ const IRNodeTypes = {
|
|
|
32709
32752
|
"12": "SLOT_OUTLET_NODE",
|
|
32710
32753
|
"DIRECTIVE": 13,
|
|
32711
32754
|
"13": "DIRECTIVE",
|
|
32712
|
-
"
|
|
32713
|
-
"14": "
|
|
32714
|
-
"
|
|
32715
|
-
"15": "
|
|
32716
|
-
"
|
|
32717
|
-
"16": "
|
|
32718
|
-
"GET_TEXT_CHILD": 17,
|
|
32719
|
-
"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"
|
|
32720
32761
|
};
|
|
32721
32762
|
const DynamicFlag = {
|
|
32722
32763
|
"NONE": 0,
|
|
@@ -32730,7 +32771,7 @@ const DynamicFlag = {
|
|
|
32730
32771
|
};
|
|
32731
32772
|
function isBlockOperation(op) {
|
|
32732
32773
|
const type = op.type;
|
|
32733
|
-
return type === 11 || type === 12 || type ===
|
|
32774
|
+
return type === 11 || type === 12 || type === 14 || type === 15;
|
|
32734
32775
|
}
|
|
32735
32776
|
|
|
32736
32777
|
function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
@@ -32961,6 +33002,10 @@ function analyzeExpressions(expressions) {
|
|
|
32961
33002
|
end: id.end
|
|
32962
33003
|
});
|
|
32963
33004
|
});
|
|
33005
|
+
const parentOfMemberExp = parentStack[parentStack.length - 2];
|
|
33006
|
+
if (parentOfMemberExp && isCallExpression(parentOfMemberExp)) {
|
|
33007
|
+
return;
|
|
33008
|
+
}
|
|
32964
33009
|
registerVariable(
|
|
32965
33010
|
memberExp,
|
|
32966
33011
|
exp,
|
|
@@ -33177,6 +33222,8 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
33177
33222
|
return `${extractMemberExpression(exp.left, onIdentifier)} ${exp.operator} ${extractMemberExpression(exp.right, onIdentifier)}`;
|
|
33178
33223
|
case "CallExpression":
|
|
33179
33224
|
return `${extractMemberExpression(exp.callee, onIdentifier)}(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
|
|
33225
|
+
case "OptionalCallExpression":
|
|
33226
|
+
return `${extractMemberExpression(exp.callee, onIdentifier)}?.(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
|
|
33180
33227
|
case "MemberExpression":
|
|
33181
33228
|
// foo[bar.baz]
|
|
33182
33229
|
case "OptionalMemberExpression":
|
|
@@ -33189,6 +33236,9 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
33189
33236
|
return "";
|
|
33190
33237
|
}
|
|
33191
33238
|
}
|
|
33239
|
+
const isCallExpression = (node) => {
|
|
33240
|
+
return node.type === "CallExpression" || node.type === "OptionalCallExpression";
|
|
33241
|
+
};
|
|
33192
33242
|
const isMemberExpression = (node) => {
|
|
33193
33243
|
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "TSNonNullExpression";
|
|
33194
33244
|
};
|
|
@@ -33872,21 +33922,16 @@ function genSetTemplateRef(oper, context) {
|
|
|
33872
33922
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
33873
33923
|
return [
|
|
33874
33924
|
NEWLINE,
|
|
33875
|
-
oper.effect && `r${oper.element} = `,
|
|
33876
33925
|
...genCall(
|
|
33877
33926
|
setTemplateRefIdent,
|
|
33878
33927
|
// will be generated in root scope
|
|
33879
33928
|
`n${oper.element}`,
|
|
33880
33929
|
refValue,
|
|
33881
|
-
oper.effect ? `r${oper.element}` : oper.refFor ? "void 0" : void 0,
|
|
33882
33930
|
oper.refFor && "true",
|
|
33883
33931
|
refKey
|
|
33884
33932
|
)
|
|
33885
33933
|
];
|
|
33886
33934
|
}
|
|
33887
|
-
function genDeclareOldRef(oper) {
|
|
33888
|
-
return [NEWLINE, `let r${oper.id}`];
|
|
33889
|
-
}
|
|
33890
33935
|
function genRefValue(value, context) {
|
|
33891
33936
|
if (value && context.options.inline) {
|
|
33892
33937
|
const binding = context.options.bindingMetadata[value.content];
|
|
@@ -34274,15 +34319,7 @@ function genDynamicProps(props, context) {
|
|
|
34274
34319
|
}
|
|
34275
34320
|
} else {
|
|
34276
34321
|
expr = genExpression(p.value, context);
|
|
34277
|
-
if (p.handler)
|
|
34278
|
-
expr = genCall(
|
|
34279
|
-
helper("toHandlers"),
|
|
34280
|
-
expr,
|
|
34281
|
-
`false`,
|
|
34282
|
-
// preserveCaseIfNecessary: false, not needed for component
|
|
34283
|
-
`true`
|
|
34284
|
-
// wrap handler values in functions
|
|
34285
|
-
);
|
|
34322
|
+
if (p.handler) expr = genCall(helper("toHandlers"), expr);
|
|
34286
34323
|
}
|
|
34287
34324
|
}
|
|
34288
34325
|
frags.push(["() => (", ...expr, ")"]);
|
|
@@ -34476,10 +34513,10 @@ function hasComponentOrSlotInDynamic(dynamic) {
|
|
|
34476
34513
|
if (type === 11 || type === 12) {
|
|
34477
34514
|
return true;
|
|
34478
34515
|
}
|
|
34479
|
-
if (type ===
|
|
34516
|
+
if (type === 14) {
|
|
34480
34517
|
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
34481
34518
|
}
|
|
34482
|
-
if (type ===
|
|
34519
|
+
if (type === 15) {
|
|
34483
34520
|
if (hasComponentOrSlotInBlock(dynamic.operation.render))
|
|
34484
34521
|
return true;
|
|
34485
34522
|
}
|
|
@@ -34495,10 +34532,10 @@ function hasComponentOrSlotInOperations(operations) {
|
|
|
34495
34532
|
case 11:
|
|
34496
34533
|
case 12:
|
|
34497
34534
|
return true;
|
|
34498
|
-
case
|
|
34535
|
+
case 14:
|
|
34499
34536
|
if (hasComponentOrSlotInIf(op)) return true;
|
|
34500
34537
|
break;
|
|
34501
|
-
case
|
|
34538
|
+
case 15:
|
|
34502
34539
|
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
34503
34540
|
break;
|
|
34504
34541
|
}
|
|
@@ -34578,19 +34615,17 @@ function genOperation(oper, context) {
|
|
|
34578
34615
|
return genInsertNode(oper, context);
|
|
34579
34616
|
case 10:
|
|
34580
34617
|
return genPrependNode(oper, context);
|
|
34581
|
-
case
|
|
34618
|
+
case 14:
|
|
34582
34619
|
return genIf(oper, context);
|
|
34583
|
-
case
|
|
34620
|
+
case 15:
|
|
34584
34621
|
return genFor(oper, context);
|
|
34585
34622
|
case 11:
|
|
34586
34623
|
return genCreateComponent(oper, context);
|
|
34587
|
-
case 14:
|
|
34588
|
-
return genDeclareOldRef(oper);
|
|
34589
34624
|
case 12:
|
|
34590
34625
|
return genSlotOutlet(oper, context);
|
|
34591
34626
|
case 13:
|
|
34592
34627
|
return genBuiltinDirective(oper, context);
|
|
34593
|
-
case
|
|
34628
|
+
case 16:
|
|
34594
34629
|
return genGetTextChild(oper, context);
|
|
34595
34630
|
default:
|
|
34596
34631
|
const exhaustiveCheck = oper;
|
|
@@ -34791,7 +34826,7 @@ function genBlock(oper, context, args = [], root) {
|
|
|
34791
34826
|
}
|
|
34792
34827
|
function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
34793
34828
|
const [frag, push] = buildCodeFragment();
|
|
34794
|
-
const { dynamic, effect, operation, returns
|
|
34829
|
+
const { dynamic, effect, operation, returns } = block;
|
|
34795
34830
|
const resetBlock = context.enterBlock(block);
|
|
34796
34831
|
if (root) {
|
|
34797
34832
|
for (let name of context.ir.component) {
|
|
@@ -34824,12 +34859,6 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
34824
34859
|
if (root && context.ir.hasDeferredVShow) {
|
|
34825
34860
|
push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`);
|
|
34826
34861
|
}
|
|
34827
|
-
if (dynamic.needsKey) {
|
|
34828
|
-
for (const child of dynamic.children) {
|
|
34829
|
-
const keyValue = key ? genExpression(key, context) : JSON.stringify(child.id);
|
|
34830
|
-
push(NEWLINE, `n${child.id}.$key = `, ...keyValue);
|
|
34831
|
-
}
|
|
34832
|
-
}
|
|
34833
34862
|
push(NEWLINE, `return `);
|
|
34834
34863
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
34835
34864
|
const returnsCode = returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "null"];
|
|
@@ -35168,7 +35197,10 @@ const transformElement = (node, context) => {
|
|
|
35168
35197
|
propsResult,
|
|
35169
35198
|
singleRoot,
|
|
35170
35199
|
context,
|
|
35171
|
-
getEffectIndex
|
|
35200
|
+
getEffectIndex,
|
|
35201
|
+
// Root-level elements generate dedicated templates
|
|
35202
|
+
// so closing tags can be omitted
|
|
35203
|
+
context.root === context.effectiveParent || canOmitEndTag(node, context)
|
|
35172
35204
|
);
|
|
35173
35205
|
}
|
|
35174
35206
|
if (parentSlots) {
|
|
@@ -35176,6 +35208,17 @@ const transformElement = (node, context) => {
|
|
|
35176
35208
|
}
|
|
35177
35209
|
};
|
|
35178
35210
|
};
|
|
35211
|
+
function canOmitEndTag(node, context) {
|
|
35212
|
+
const { block, parent } = context;
|
|
35213
|
+
if (!parent) return false;
|
|
35214
|
+
if (block !== parent.block) {
|
|
35215
|
+
return true;
|
|
35216
|
+
}
|
|
35217
|
+
if (isFormattingTag(node.tag) || parent.node.type === 1 && node.tag === parent.node.tag) {
|
|
35218
|
+
return context.isOnRightmostPath;
|
|
35219
|
+
}
|
|
35220
|
+
return context.isLastEffectiveChild;
|
|
35221
|
+
}
|
|
35179
35222
|
function isSingleRoot(context) {
|
|
35180
35223
|
if (context.inVFor) {
|
|
35181
35224
|
return false;
|
|
@@ -35265,7 +35308,8 @@ function resolveSetupReference(name, context) {
|
|
|
35265
35308
|
return bindings[name] ? name : bindings[camelName] ? camelName : bindings[PascalName] ? PascalName : void 0;
|
|
35266
35309
|
}
|
|
35267
35310
|
const dynamicKeys = ["indeterminate"];
|
|
35268
|
-
|
|
35311
|
+
const NEEDS_QUOTES_RE = /[\s"'`=<>]/;
|
|
35312
|
+
function transformNativeElement(node, propsResult, singleRoot, context, getEffectIndex, omitEndTag) {
|
|
35269
35313
|
const { tag } = node;
|
|
35270
35314
|
const { scopeId } = context.options;
|
|
35271
35315
|
let template = "";
|
|
@@ -35285,16 +35329,24 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
35285
35329
|
getEffectIndex
|
|
35286
35330
|
);
|
|
35287
35331
|
} else {
|
|
35332
|
+
let prevWasQuoted = false;
|
|
35288
35333
|
for (const prop of propsResult[1]) {
|
|
35289
35334
|
const { key, values } = prop;
|
|
35290
35335
|
if (context.imports.some(
|
|
35291
35336
|
(imported) => values[0].content.includes(imported.exp.content)
|
|
35292
35337
|
)) {
|
|
35293
|
-
template += `
|
|
35338
|
+
if (!prevWasQuoted) template += ` `;
|
|
35339
|
+
template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
35340
|
+
prevWasQuoted = true;
|
|
35294
35341
|
} else if (key.isStatic && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
|
|
35295
|
-
template += `
|
|
35296
|
-
|
|
35297
|
-
|
|
35342
|
+
if (!prevWasQuoted) template += ` `;
|
|
35343
|
+
const value = values[0].content === "''" ? "" : values[0].content;
|
|
35344
|
+
template += key.content;
|
|
35345
|
+
if (value) {
|
|
35346
|
+
template += (prevWasQuoted = NEEDS_QUOTES_RE.test(value)) ? `="${value.replace(/"/g, """)}"` : `=${value}`;
|
|
35347
|
+
} else {
|
|
35348
|
+
prevWasQuoted = false;
|
|
35349
|
+
}
|
|
35298
35350
|
} else {
|
|
35299
35351
|
dynamicProps.push(key.content);
|
|
35300
35352
|
context.registerEffect(
|
|
@@ -35311,7 +35363,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
35311
35363
|
}
|
|
35312
35364
|
}
|
|
35313
35365
|
template += `>` + context.childrenTemplate.join("");
|
|
35314
|
-
if (!isVoidTag(tag)) {
|
|
35366
|
+
if (!isVoidTag(tag) && !omitEndTag) {
|
|
35315
35367
|
template += `</${tag}>`;
|
|
35316
35368
|
}
|
|
35317
35369
|
if (singleRoot) {
|
|
@@ -35519,7 +35571,7 @@ const transformVText = (dir, node, context) => {
|
|
|
35519
35571
|
const isComponent = node.tagType === 1;
|
|
35520
35572
|
if (!isComponent) {
|
|
35521
35573
|
context.registerOperation({
|
|
35522
|
-
type:
|
|
35574
|
+
type: 16,
|
|
35523
35575
|
parent: context.reference()
|
|
35524
35576
|
});
|
|
35525
35577
|
}
|
|
@@ -35696,10 +35748,6 @@ const transformTemplateRef = (node, context) => {
|
|
|
35696
35748
|
return () => {
|
|
35697
35749
|
const id = context.reference();
|
|
35698
35750
|
const effect = !isConstantExpression(value);
|
|
35699
|
-
effect && context.registerOperation({
|
|
35700
|
-
type: 14,
|
|
35701
|
-
id
|
|
35702
|
-
});
|
|
35703
35751
|
context.registerEffect([value], {
|
|
35704
35752
|
type: 8,
|
|
35705
35753
|
element: id,
|
|
@@ -35784,7 +35832,7 @@ function processTextContainer(children, context) {
|
|
|
35784
35832
|
} else {
|
|
35785
35833
|
context.childrenTemplate = [" "];
|
|
35786
35834
|
context.registerOperation({
|
|
35787
|
-
type:
|
|
35835
|
+
type: 16,
|
|
35788
35836
|
parent: context.reference()
|
|
35789
35837
|
});
|
|
35790
35838
|
context.registerEffect(values, {
|
|
@@ -35973,7 +36021,7 @@ function processIf(node, dir, context) {
|
|
|
35973
36021
|
return () => {
|
|
35974
36022
|
onExit();
|
|
35975
36023
|
context.dynamic.operation = {
|
|
35976
|
-
type:
|
|
36024
|
+
type: 14,
|
|
35977
36025
|
id,
|
|
35978
36026
|
condition: dir.exp,
|
|
35979
36027
|
positive: branch,
|
|
@@ -35988,7 +36036,7 @@ function processIf(node, dir, context) {
|
|
|
35988
36036
|
if (siblings) {
|
|
35989
36037
|
let i = siblings.length;
|
|
35990
36038
|
while (i--) {
|
|
35991
|
-
if (siblings[i].operation && siblings[i].operation.type ===
|
|
36039
|
+
if (siblings[i].operation && siblings[i].operation.type === 14) {
|
|
35992
36040
|
lastIfNode = siblings[i].operation;
|
|
35993
36041
|
break;
|
|
35994
36042
|
}
|
|
@@ -35997,14 +36045,14 @@ function processIf(node, dir, context) {
|
|
|
35997
36045
|
if (
|
|
35998
36046
|
// check if v-if is the sibling node
|
|
35999
36047
|
!siblingIf || // check if IfNode is the last operation and get the root IfNode
|
|
36000
|
-
!lastIfNode || lastIfNode.type !==
|
|
36048
|
+
!lastIfNode || lastIfNode.type !== 14
|
|
36001
36049
|
) {
|
|
36002
36050
|
context.options.onError(
|
|
36003
36051
|
createCompilerError(30, node.loc)
|
|
36004
36052
|
);
|
|
36005
36053
|
return;
|
|
36006
36054
|
}
|
|
36007
|
-
while (lastIfNode.negative && lastIfNode.negative.type ===
|
|
36055
|
+
while (lastIfNode.negative && lastIfNode.negative.type === 14) {
|
|
36008
36056
|
lastIfNode = lastIfNode.negative;
|
|
36009
36057
|
}
|
|
36010
36058
|
if (dir.name === "else-if" && lastIfNode.negative) {
|
|
@@ -36024,7 +36072,7 @@ function processIf(node, dir, context) {
|
|
|
36024
36072
|
lastIfNode.negative = branch;
|
|
36025
36073
|
} else {
|
|
36026
36074
|
lastIfNode.negative = {
|
|
36027
|
-
type:
|
|
36075
|
+
type: 14,
|
|
36028
36076
|
id: -1,
|
|
36029
36077
|
condition: dir.exp,
|
|
36030
36078
|
positive: branch,
|
|
@@ -36039,7 +36087,6 @@ function createIfBranch(node, context) {
|
|
|
36039
36087
|
const branch = newBlock(node);
|
|
36040
36088
|
const exitBlock = context.enterBlock(branch);
|
|
36041
36089
|
context.reference();
|
|
36042
|
-
branch.dynamic.needsKey = isInTransition(context);
|
|
36043
36090
|
return [branch, exitBlock];
|
|
36044
36091
|
}
|
|
36045
36092
|
|
|
@@ -36077,7 +36124,7 @@ function processFor(node, dir, context) {
|
|
|
36077
36124
|
const { parent } = context;
|
|
36078
36125
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
36079
36126
|
context.dynamic.operation = {
|
|
36080
|
-
type:
|
|
36127
|
+
type: 15,
|
|
36081
36128
|
id,
|
|
36082
36129
|
source,
|
|
36083
36130
|
value,
|
|
@@ -36238,10 +36285,10 @@ function transformComponentSlot(node, dir, context) {
|
|
|
36238
36285
|
markNonTemplate(n, context);
|
|
36239
36286
|
});
|
|
36240
36287
|
}
|
|
36241
|
-
|
|
36288
|
+
const [block, onExit] = createSlotBlock(node, dir, context);
|
|
36242
36289
|
if (isTransitionNode(node) && nonSlotTemplateChildren.length) {
|
|
36243
36290
|
const nonCommentChild = nonSlotTemplateChildren.find(
|
|
36244
|
-
(n) => n
|
|
36291
|
+
(n) => !isCommentOrWhitespace(n)
|
|
36245
36292
|
);
|
|
36246
36293
|
if (nonCommentChild) {
|
|
36247
36294
|
const keyProp = findProp(
|
|
@@ -36249,11 +36296,10 @@ function transformComponentSlot(node, dir, context) {
|
|
|
36249
36296
|
"key"
|
|
36250
36297
|
);
|
|
36251
36298
|
if (keyProp) {
|
|
36252
|
-
|
|
36299
|
+
block.key = keyProp.exp;
|
|
36253
36300
|
}
|
|
36254
36301
|
}
|
|
36255
36302
|
}
|
|
36256
|
-
const [block, onExit] = createSlotBlock(node, dir, context, slotKey);
|
|
36257
36303
|
const { slots } = context;
|
|
36258
36304
|
return () => {
|
|
36259
36305
|
onExit();
|
|
@@ -36387,13 +36433,9 @@ function hasStaticSlot(slots, name) {
|
|
|
36387
36433
|
if (slot.slotType === 0) return !!slot.slots[name];
|
|
36388
36434
|
});
|
|
36389
36435
|
}
|
|
36390
|
-
function createSlotBlock(slotNode, dir, context
|
|
36436
|
+
function createSlotBlock(slotNode, dir, context) {
|
|
36391
36437
|
const block = newBlock(slotNode);
|
|
36392
36438
|
block.props = dir && dir.exp;
|
|
36393
|
-
if (key) {
|
|
36394
|
-
block.key = key;
|
|
36395
|
-
block.dynamic.needsKey = true;
|
|
36396
|
-
}
|
|
36397
36439
|
const exitBlock = context.enterBlock(block);
|
|
36398
36440
|
return [block, exitBlock];
|
|
36399
36441
|
}
|
|
@@ -55036,7 +55078,8 @@ let __temp${any}, __restore${any}
|
|
|
55036
55078
|
if (preamble) {
|
|
55037
55079
|
ctx.s.prepend(preamble);
|
|
55038
55080
|
}
|
|
55039
|
-
if (helpers && helpers.has(UNREF)
|
|
55081
|
+
if (helpers && (helpers.has(UNREF) || // vapor compiler uses 'unref' instead of UNREF
|
|
55082
|
+
helpers.has("unref"))) {
|
|
55040
55083
|
ctx.helperImports.delete("unref");
|
|
55041
55084
|
}
|
|
55042
55085
|
returned = code;
|
|
@@ -55344,7 +55387,7 @@ var __spreadValues = (a, b) => {
|
|
|
55344
55387
|
}
|
|
55345
55388
|
return a;
|
|
55346
55389
|
};
|
|
55347
|
-
const version = "3.6.0-beta.
|
|
55390
|
+
const version = "3.6.0-beta.3";
|
|
55348
55391
|
const parseCache = parseCache$1;
|
|
55349
55392
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
55350
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-core": "3.6.0-beta.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-
|
|
53
|
-
"@vue/compiler-
|
|
54
|
-
"@vue/shared": "3.6.0-beta.
|
|
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",
|