@vue/compiler-sfc 3.6.0-alpha.4 → 3.6.0-alpha.5
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 +10 -6
- package/dist/compiler-sfc.esm-browser.js +100 -66
- 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-alpha.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -126,6 +126,9 @@ var hashSumExports = /*@__PURE__*/ requireHashSum();
|
|
|
126
126
|
var hash = /*@__PURE__*/getDefaultExportFromCjs(hashSumExports);
|
|
127
127
|
|
|
128
128
|
const CSS_VARS_HELPER = `useCssVars`;
|
|
129
|
+
function getCssVarsHelper(vapor) {
|
|
130
|
+
return vapor ? `useVaporCssVars` : CSS_VARS_HELPER;
|
|
131
|
+
}
|
|
129
132
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
130
133
|
return `{
|
|
131
134
|
${vars.map(
|
|
@@ -234,7 +237,7 @@ const cssVarsPlugin = (opts) => {
|
|
|
234
237
|
};
|
|
235
238
|
};
|
|
236
239
|
cssVarsPlugin.postcss = true;
|
|
237
|
-
function genCssVarsCode(vars, bindings, id, isProd) {
|
|
240
|
+
function genCssVarsCode(vars, bindings, id, isProd, vapor) {
|
|
238
241
|
const varsExp = genCssVarsFromList(vars, id, isProd);
|
|
239
242
|
const exp = CompilerDOM.createSimpleExpression(varsExp, false);
|
|
240
243
|
const context = CompilerDOM.createTransformContext(CompilerDOM.createRoot([]), {
|
|
@@ -246,7 +249,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
|
|
|
246
249
|
const transformedString = transformed.type === 4 ? transformed.content : transformed.children.map((c) => {
|
|
247
250
|
return typeof c === "string" ? c : c.content;
|
|
248
251
|
}).join("");
|
|
249
|
-
return `_${
|
|
252
|
+
return `_${getCssVarsHelper(vapor)}(_ctx => (${transformedString}))`;
|
|
250
253
|
}
|
|
251
254
|
function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
|
|
252
255
|
return `
|
|
@@ -21332,7 +21335,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
|
|
|
21332
21335
|
}
|
|
21333
21336
|
if (sfc.cssVars.length && // no need to do this when targeting SSR
|
|
21334
21337
|
!ssr) {
|
|
21335
|
-
ctx.helperImports.add(
|
|
21338
|
+
ctx.helperImports.add(getCssVarsHelper(vapor));
|
|
21336
21339
|
ctx.helperImports.add("unref");
|
|
21337
21340
|
ctx.s.prependLeft(
|
|
21338
21341
|
startOffset,
|
|
@@ -21341,7 +21344,8 @@ ${genCssVarsCode(
|
|
|
21341
21344
|
sfc.cssVars,
|
|
21342
21345
|
ctx.bindingMetadata,
|
|
21343
21346
|
scopeId,
|
|
21344
|
-
!!options.isProd
|
|
21347
|
+
!!options.isProd,
|
|
21348
|
+
vapor
|
|
21345
21349
|
)}
|
|
21346
21350
|
`
|
|
21347
21351
|
);
|
|
@@ -21752,7 +21756,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
21752
21756
|
return generator.toJSON();
|
|
21753
21757
|
}
|
|
21754
21758
|
|
|
21755
|
-
const version = "3.6.0-alpha.
|
|
21759
|
+
const version = "3.6.0-alpha.5";
|
|
21756
21760
|
const parseCache = parseCache$1;
|
|
21757
21761
|
const errorMessages = {
|
|
21758
21762
|
...CompilerDOM.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -18115,7 +18115,43 @@ function getMemoedVNodeCall(node) {
|
|
|
18115
18115
|
return node;
|
|
18116
18116
|
}
|
|
18117
18117
|
}
|
|
18118
|
+
function filterNonCommentChildren(node) {
|
|
18119
|
+
return node.children.filter((n) => n.type !== 3);
|
|
18120
|
+
}
|
|
18121
|
+
function hasSingleChild(node) {
|
|
18122
|
+
return filterNonCommentChildren(node).length === 1;
|
|
18123
|
+
}
|
|
18124
|
+
function isSingleIfBlock(parent) {
|
|
18125
|
+
let hasEncounteredIf = false;
|
|
18126
|
+
for (const c of filterNonCommentChildren(parent)) {
|
|
18127
|
+
if (c.type === 9 || c.type === 1 && findDir$1(c, "if")) {
|
|
18128
|
+
if (hasEncounteredIf) return false;
|
|
18129
|
+
hasEncounteredIf = true;
|
|
18130
|
+
} else if (
|
|
18131
|
+
// node before v-if
|
|
18132
|
+
!hasEncounteredIf || // non else nodes
|
|
18133
|
+
!(c.type === 1 && findDir$1(c, /^else(-if)?$/, true))
|
|
18134
|
+
) {
|
|
18135
|
+
return false;
|
|
18136
|
+
}
|
|
18137
|
+
}
|
|
18138
|
+
return true;
|
|
18139
|
+
}
|
|
18118
18140
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
18141
|
+
function isAllWhitespace(str) {
|
|
18142
|
+
for (let i = 0; i < str.length; i++) {
|
|
18143
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
18144
|
+
return false;
|
|
18145
|
+
}
|
|
18146
|
+
}
|
|
18147
|
+
return true;
|
|
18148
|
+
}
|
|
18149
|
+
function isWhitespaceText(node) {
|
|
18150
|
+
return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
|
|
18151
|
+
}
|
|
18152
|
+
function isCommentOrWhitespace(node) {
|
|
18153
|
+
return node.type === 3 || isWhitespaceText(node);
|
|
18154
|
+
}
|
|
18119
18155
|
|
|
18120
18156
|
const defaultParserOptions = {
|
|
18121
18157
|
parseMode: "base",
|
|
@@ -18652,14 +18688,6 @@ function condenseWhitespace(nodes) {
|
|
|
18652
18688
|
}
|
|
18653
18689
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
18654
18690
|
}
|
|
18655
|
-
function isAllWhitespace(str) {
|
|
18656
|
-
for (let i = 0; i < str.length; i++) {
|
|
18657
|
-
if (!isWhitespace(str.charCodeAt(i))) {
|
|
18658
|
-
return false;
|
|
18659
|
-
}
|
|
18660
|
-
}
|
|
18661
|
-
return true;
|
|
18662
|
-
}
|
|
18663
18691
|
function hasNewlineChar(str) {
|
|
18664
18692
|
for (let i = 0; i < str.length; i++) {
|
|
18665
18693
|
const c = str.charCodeAt(i);
|
|
@@ -23905,13 +23933,11 @@ function processIf$1(node, dir, context, processCodegen) {
|
|
|
23905
23933
|
let i = siblings.indexOf(node);
|
|
23906
23934
|
while (i-- >= -1) {
|
|
23907
23935
|
const sibling = siblings[i];
|
|
23908
|
-
if (sibling && sibling
|
|
23909
|
-
context.removeNode(sibling);
|
|
23910
|
-
comments.unshift(sibling);
|
|
23911
|
-
continue;
|
|
23912
|
-
}
|
|
23913
|
-
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
23936
|
+
if (sibling && isCommentOrWhitespace(sibling)) {
|
|
23914
23937
|
context.removeNode(sibling);
|
|
23938
|
+
if (sibling.type === 3) {
|
|
23939
|
+
comments.unshift(sibling);
|
|
23940
|
+
}
|
|
23915
23941
|
continue;
|
|
23916
23942
|
}
|
|
23917
23943
|
if (sibling && sibling.type === 9) {
|
|
@@ -24429,7 +24455,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
24429
24455
|
let prev;
|
|
24430
24456
|
while (j--) {
|
|
24431
24457
|
prev = children[j];
|
|
24432
|
-
if (
|
|
24458
|
+
if (!isCommentOrWhitespace(prev)) {
|
|
24433
24459
|
break;
|
|
24434
24460
|
}
|
|
24435
24461
|
}
|
|
@@ -24504,7 +24530,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
24504
24530
|
} else if (implicitDefaultChildren.length && // #3766
|
|
24505
24531
|
// with whitespace: 'preserve', whitespaces between slots will end up in
|
|
24506
24532
|
// implicitDefaultChildren. Ignore if all implicit children are whitespaces.
|
|
24507
|
-
implicitDefaultChildren.
|
|
24533
|
+
!implicitDefaultChildren.every(isWhitespaceText)) {
|
|
24508
24534
|
if (hasNamedDefaultSlot) {
|
|
24509
24535
|
context.onError(
|
|
24510
24536
|
createCompilerError(
|
|
@@ -24577,11 +24603,6 @@ function hasForwardedSlots(children) {
|
|
|
24577
24603
|
}
|
|
24578
24604
|
return false;
|
|
24579
24605
|
}
|
|
24580
|
-
function isNonWhitespaceContent$1(node) {
|
|
24581
|
-
if (node.type !== 2 && node.type !== 12)
|
|
24582
|
-
return true;
|
|
24583
|
-
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent$1(node.content);
|
|
24584
|
-
}
|
|
24585
24606
|
|
|
24586
24607
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
24587
24608
|
const transformElement$1 = (node, context) => {
|
|
@@ -26151,7 +26172,7 @@ function postTransformTransition(node, onError, hasMultipleChildren = defaultHas
|
|
|
26151
26172
|
}
|
|
26152
26173
|
function defaultHasMultipleChildren(node) {
|
|
26153
26174
|
const children = node.children = node.children.filter(
|
|
26154
|
-
(c) =>
|
|
26175
|
+
(c) => !isCommentOrWhitespace(c)
|
|
26155
26176
|
);
|
|
26156
26177
|
const child = children[0];
|
|
26157
26178
|
return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
|
|
@@ -26718,6 +26739,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26718
26739
|
defaultOnWarn: defaultOnWarn,
|
|
26719
26740
|
errorMessages: errorMessages$1,
|
|
26720
26741
|
extractIdentifiers: extractIdentifiers$1,
|
|
26742
|
+
filterNonCommentChildren: filterNonCommentChildren,
|
|
26721
26743
|
findDir: findDir$1,
|
|
26722
26744
|
findProp: findProp$1,
|
|
26723
26745
|
forAliasRE: forAliasRE,
|
|
@@ -26731,8 +26753,11 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26731
26753
|
getVNodeHelper: getVNodeHelper,
|
|
26732
26754
|
hasDynamicKeyVBind: hasDynamicKeyVBind,
|
|
26733
26755
|
hasScopeRef: hasScopeRef,
|
|
26756
|
+
hasSingleChild: hasSingleChild,
|
|
26734
26757
|
helperNameMap: helperNameMap,
|
|
26735
26758
|
injectProp: injectProp,
|
|
26759
|
+
isAllWhitespace: isAllWhitespace,
|
|
26760
|
+
isCommentOrWhitespace: isCommentOrWhitespace,
|
|
26736
26761
|
isConstantNode: isConstantNode,
|
|
26737
26762
|
isCoreComponent: isCoreComponent,
|
|
26738
26763
|
isFnExpression: isFnExpression,
|
|
@@ -26747,6 +26772,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26747
26772
|
isMemberExpressionNode: isMemberExpressionNode,
|
|
26748
26773
|
isReferencedIdentifier: isReferencedIdentifier,
|
|
26749
26774
|
isSimpleIdentifier: isSimpleIdentifier,
|
|
26775
|
+
isSingleIfBlock: isSingleIfBlock,
|
|
26750
26776
|
isSlotOutlet: isSlotOutlet,
|
|
26751
26777
|
isStaticArgOf: isStaticArgOf,
|
|
26752
26778
|
isStaticExp: isStaticExp,
|
|
@@ -26758,6 +26784,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26758
26784
|
isVPre: isVPre,
|
|
26759
26785
|
isVSlot: isVSlot,
|
|
26760
26786
|
isValidHTMLNesting: isValidHTMLNesting,
|
|
26787
|
+
isWhitespaceText: isWhitespaceText,
|
|
26761
26788
|
locStub: locStub,
|
|
26762
26789
|
noopDirectiveTransform: noopDirectiveTransform,
|
|
26763
26790
|
parse: parse$3,
|
|
@@ -26872,6 +26899,9 @@ var hashSumExports = /*@__PURE__*/ requireHashSum();
|
|
|
26872
26899
|
var hash = /*@__PURE__*/getDefaultExportFromCjs(hashSumExports);
|
|
26873
26900
|
|
|
26874
26901
|
const CSS_VARS_HELPER = `useCssVars`;
|
|
26902
|
+
function getCssVarsHelper(vapor) {
|
|
26903
|
+
return vapor ? `useVaporCssVars` : CSS_VARS_HELPER;
|
|
26904
|
+
}
|
|
26875
26905
|
function genCssVarsFromList(vars, id, isProd, isSSR = false) {
|
|
26876
26906
|
return `{
|
|
26877
26907
|
${vars.map(
|
|
@@ -26980,7 +27010,7 @@ const cssVarsPlugin = (opts) => {
|
|
|
26980
27010
|
};
|
|
26981
27011
|
};
|
|
26982
27012
|
cssVarsPlugin.postcss = true;
|
|
26983
|
-
function genCssVarsCode(vars, bindings, id, isProd) {
|
|
27013
|
+
function genCssVarsCode(vars, bindings, id, isProd, vapor) {
|
|
26984
27014
|
const varsExp = genCssVarsFromList(vars, id, isProd);
|
|
26985
27015
|
const exp = createSimpleExpression(varsExp, false);
|
|
26986
27016
|
const context = createTransformContext(createRoot([]), {
|
|
@@ -26992,7 +27022,7 @@ function genCssVarsCode(vars, bindings, id, isProd) {
|
|
|
26992
27022
|
const transformedString = transformed.type === 4 ? transformed.content : transformed.children.map((c) => {
|
|
26993
27023
|
return typeof c === "string" ? c : c.content;
|
|
26994
27024
|
}).join("");
|
|
26995
|
-
return `_${
|
|
27025
|
+
return `_${getCssVarsHelper(vapor)}(_ctx => (${transformedString}))`;
|
|
26996
27026
|
}
|
|
26997
27027
|
function genNormalScriptCssVarsCode(cssVars, bindings, id, isProd, defaultVar) {
|
|
26998
27028
|
return `
|
|
@@ -32286,6 +32316,7 @@ function transform(node, options = {}) {
|
|
|
32286
32316
|
source: node.source,
|
|
32287
32317
|
template: /* @__PURE__ */ new Map(),
|
|
32288
32318
|
templateIndexMap: /* @__PURE__ */ new Map(),
|
|
32319
|
+
rootTemplateIndexes: /* @__PURE__ */ new Set(),
|
|
32289
32320
|
component: /* @__PURE__ */ new Set(),
|
|
32290
32321
|
directive: /* @__PURE__ */ new Set(),
|
|
32291
32322
|
block: newBlock(node),
|
|
@@ -32782,8 +32813,10 @@ function analyzeExpressions(expressions) {
|
|
|
32782
32813
|
exp.ast === null && registerVariable(exp.content, exp, true);
|
|
32783
32814
|
continue;
|
|
32784
32815
|
}
|
|
32816
|
+
const seenParents = /* @__PURE__ */ new Set();
|
|
32785
32817
|
walkIdentifiers(exp.ast, (currentNode, parent, parentStack) => {
|
|
32786
|
-
if (parent && isMemberExpression(parent)) {
|
|
32818
|
+
if (parent && isMemberExpression(parent) && !seenParents.has(parent)) {
|
|
32819
|
+
seenParents.add(parent);
|
|
32787
32820
|
const memberExp = extractMemberExpression(parent, (id) => {
|
|
32788
32821
|
registerVariable(id.name, exp, true, {
|
|
32789
32822
|
start: id.start,
|
|
@@ -32885,7 +32918,7 @@ function shouldDeclareVariable(name, expToVariableMap, exps) {
|
|
|
32885
32918
|
}
|
|
32886
32919
|
return true;
|
|
32887
32920
|
}
|
|
32888
|
-
if (vars.
|
|
32921
|
+
if (vars.every((v) => v.every((e, idx) => e === first[idx]))) {
|
|
32889
32922
|
return false;
|
|
32890
32923
|
}
|
|
32891
32924
|
return true;
|
|
@@ -32894,7 +32927,9 @@ function processRepeatedExpressions(context, expressions, varDeclarations, updat
|
|
|
32894
32927
|
const declarations = [];
|
|
32895
32928
|
const seenExp = expressions.reduce(
|
|
32896
32929
|
(acc, exp) => {
|
|
32897
|
-
const
|
|
32930
|
+
const vars = expToVariableMap.get(exp);
|
|
32931
|
+
if (!vars) return acc;
|
|
32932
|
+
const variables = vars.map((v) => v.name);
|
|
32898
32933
|
if (exp.ast && exp.ast.type !== "Identifier" && !(variables && variables.some((v) => updatedVariable.has(v)))) {
|
|
32899
32934
|
acc[exp.content] = (acc[exp.content] || 0) + 1;
|
|
32900
32935
|
}
|
|
@@ -33010,12 +33045,14 @@ function extractMemberExpression(exp, onIdentifier) {
|
|
|
33010
33045
|
const object = extractMemberExpression(exp.object, onIdentifier);
|
|
33011
33046
|
const prop = exp.computed ? `[${extractMemberExpression(exp.property, onIdentifier)}]` : `.${extractMemberExpression(exp.property, NOOP)}`;
|
|
33012
33047
|
return `${object}${prop}`;
|
|
33048
|
+
case "TSNonNullExpression":
|
|
33049
|
+
return `${extractMemberExpression(exp.expression, onIdentifier)}`;
|
|
33013
33050
|
default:
|
|
33014
33051
|
return "";
|
|
33015
33052
|
}
|
|
33016
33053
|
}
|
|
33017
33054
|
const isMemberExpression = (node) => {
|
|
33018
|
-
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression";
|
|
33055
|
+
return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "TSNonNullExpression";
|
|
33019
33056
|
};
|
|
33020
33057
|
|
|
33021
33058
|
function genSetEvent(oper, context) {
|
|
@@ -33586,7 +33623,6 @@ function genDynamicProps$1(oper, context) {
|
|
|
33586
33623
|
helper("setDynamicProps"),
|
|
33587
33624
|
`n${oper.element}`,
|
|
33588
33625
|
genMulti(DELIMITERS_ARRAY, ...values),
|
|
33589
|
-
oper.root && "true",
|
|
33590
33626
|
isSVG && "true"
|
|
33591
33627
|
)
|
|
33592
33628
|
];
|
|
@@ -34167,7 +34203,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
34167
34203
|
`}`
|
|
34168
34204
|
];
|
|
34169
34205
|
}
|
|
34170
|
-
if (node.type === 1) {
|
|
34206
|
+
if (node.type === 1 && !isKeepAliveTag(node.tag)) {
|
|
34171
34207
|
blockFn = [`${context.helper("withVaporCtx")}(`, ...blockFn, `)`];
|
|
34172
34208
|
}
|
|
34173
34209
|
return blockFn;
|
|
@@ -34323,7 +34359,7 @@ function genInsertionState(operation, context) {
|
|
|
34323
34359
|
];
|
|
34324
34360
|
}
|
|
34325
34361
|
|
|
34326
|
-
function genTemplates(templates,
|
|
34362
|
+
function genTemplates(templates, rootIndexes, context) {
|
|
34327
34363
|
const result = [];
|
|
34328
34364
|
let i = 0;
|
|
34329
34365
|
templates.forEach((ns, template) => {
|
|
@@ -34334,7 +34370,7 @@ function genTemplates(templates, rootIndex, context) {
|
|
|
34334
34370
|
// replace import expressions with string concatenation
|
|
34335
34371
|
IMPORT_EXPR_RE,
|
|
34336
34372
|
`" + $1 + "`
|
|
34337
|
-
)}${i
|
|
34373
|
+
)}${rootIndexes.has(i) ? ", true" : ns ? ", false" : ""}${ns ? `, ${ns}` : ""})
|
|
34338
34374
|
`
|
|
34339
34375
|
);
|
|
34340
34376
|
i++;
|
|
@@ -34634,7 +34670,7 @@ function generate(ir, options = {}) {
|
|
|
34634
34670
|
push("}");
|
|
34635
34671
|
}
|
|
34636
34672
|
const delegates = genDelegates(context);
|
|
34637
|
-
const templates = genTemplates(ir.template, ir.
|
|
34673
|
+
const templates = genTemplates(ir.template, ir.rootTemplateIndexes, context);
|
|
34638
34674
|
const imports = genHelperImports(context) + genAssetImports(context);
|
|
34639
34675
|
const preamble = imports + templates + delegates;
|
|
34640
34676
|
const newlineCount = [...preamble].filter((c) => c === "\n").length;
|
|
@@ -34795,11 +34831,7 @@ const transformElement = (node, context) => {
|
|
|
34795
34831
|
isDynamicComponent,
|
|
34796
34832
|
getEffectIndex
|
|
34797
34833
|
);
|
|
34798
|
-
|
|
34799
|
-
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
34800
|
-
parent = parent.parent;
|
|
34801
|
-
}
|
|
34802
|
-
const singleRoot = context.root === parent && parent.node.children.filter((child) => child.type !== 3).length === 1 || isCustomElement;
|
|
34834
|
+
const singleRoot = isSingleRoot(context);
|
|
34803
34835
|
if (isComponent) {
|
|
34804
34836
|
transformComponentElement(
|
|
34805
34837
|
node,
|
|
@@ -34820,6 +34852,22 @@ const transformElement = (node, context) => {
|
|
|
34820
34852
|
}
|
|
34821
34853
|
};
|
|
34822
34854
|
};
|
|
34855
|
+
function isSingleRoot(context) {
|
|
34856
|
+
if (context.inVFor) {
|
|
34857
|
+
return false;
|
|
34858
|
+
}
|
|
34859
|
+
let { parent } = context;
|
|
34860
|
+
if (parent && !(hasSingleChild(parent.node) || isSingleIfBlock(parent.node))) {
|
|
34861
|
+
return false;
|
|
34862
|
+
}
|
|
34863
|
+
while (parent && parent.parent && parent.node.type === 1 && parent.node.tagType === 3) {
|
|
34864
|
+
parent = parent.parent;
|
|
34865
|
+
if (!(hasSingleChild(parent.node) || isSingleIfBlock(parent.node))) {
|
|
34866
|
+
return false;
|
|
34867
|
+
}
|
|
34868
|
+
}
|
|
34869
|
+
return context.root === parent;
|
|
34870
|
+
}
|
|
34823
34871
|
function transformComponentElement(node, propsResult, singleRoot, context, isDynamicComponent, isCustomElement) {
|
|
34824
34872
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
34825
34873
|
let { tag } = node;
|
|
@@ -34857,7 +34905,7 @@ function transformComponentElement(node, propsResult, singleRoot, context, isDyn
|
|
|
34857
34905
|
tag,
|
|
34858
34906
|
props: propsResult[0] ? propsResult[1] : [propsResult[1]],
|
|
34859
34907
|
asset,
|
|
34860
|
-
root: singleRoot
|
|
34908
|
+
root: singleRoot,
|
|
34861
34909
|
slots: [...context.slots],
|
|
34862
34910
|
once: context.inVOnce,
|
|
34863
34911
|
dynamic: dynamicComponent,
|
|
@@ -34908,7 +34956,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
34908
34956
|
type: 3,
|
|
34909
34957
|
element: context.reference(),
|
|
34910
34958
|
props: dynamicArgs,
|
|
34911
|
-
root: singleRoot,
|
|
34912
34959
|
tag
|
|
34913
34960
|
},
|
|
34914
34961
|
getEffectIndex
|
|
@@ -34932,7 +34979,6 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
34932
34979
|
type: 2,
|
|
34933
34980
|
element: context.reference(),
|
|
34934
34981
|
prop,
|
|
34935
|
-
root: singleRoot,
|
|
34936
34982
|
tag
|
|
34937
34983
|
},
|
|
34938
34984
|
getEffectIndex
|
|
@@ -34945,7 +34991,7 @@ function transformNativeElement(node, propsResult, singleRoot, context, getEffec
|
|
|
34945
34991
|
template += `</${tag}>`;
|
|
34946
34992
|
}
|
|
34947
34993
|
if (singleRoot) {
|
|
34948
|
-
context.ir.
|
|
34994
|
+
context.ir.rootTemplateIndexes.add(context.ir.template.size);
|
|
34949
34995
|
}
|
|
34950
34996
|
if (context.parent && context.parent.node.type === 1 && !isValidHTMLNesting(context.parent.node.tag, tag)) {
|
|
34951
34997
|
context.reference();
|
|
@@ -37317,11 +37363,11 @@ const ssrTransformModel = (dir, node, context) => {
|
|
|
37317
37363
|
}
|
|
37318
37364
|
if (node.tagType === 0) {
|
|
37319
37365
|
const res = { props: [] };
|
|
37320
|
-
const defaultProps = [
|
|
37321
|
-
// default value binding for text type inputs
|
|
37322
|
-
createObjectProperty(`value`, model)
|
|
37323
|
-
];
|
|
37324
37366
|
if (node.tag === "input") {
|
|
37367
|
+
const defaultProps = [
|
|
37368
|
+
// default value binding for text type inputs
|
|
37369
|
+
createObjectProperty(`value`, model)
|
|
37370
|
+
];
|
|
37325
37371
|
const type = findProp$1(node, "type");
|
|
37326
37372
|
if (type) {
|
|
37327
37373
|
const value = findValueBinding(node);
|
|
@@ -37442,14 +37488,12 @@ const ssrTransformShow = (dir, node, context) => {
|
|
|
37442
37488
|
};
|
|
37443
37489
|
};
|
|
37444
37490
|
|
|
37445
|
-
const filterChild = (node) => node.children.filter((n) => n.type !== 3);
|
|
37446
|
-
const hasSingleChild = (node) => filterChild(node).length === 1;
|
|
37447
37491
|
const ssrInjectFallthroughAttrs = (node, context) => {
|
|
37448
37492
|
if (node.type === 0) {
|
|
37449
37493
|
context.identifiers._attrs = 1;
|
|
37450
37494
|
}
|
|
37451
37495
|
if (node.type === 1 && node.tagType === 1 && (node.tag === "transition" || node.tag === "Transition" || node.tag === "KeepAlive" || node.tag === "keep-alive")) {
|
|
37452
|
-
const rootChildren =
|
|
37496
|
+
const rootChildren = filterNonCommentChildren(context.root);
|
|
37453
37497
|
if (rootChildren.length === 1 && rootChildren[0] === node) {
|
|
37454
37498
|
if (hasSingleChild(node)) {
|
|
37455
37499
|
injectFallthroughAttrs(node.children[0]);
|
|
@@ -37462,20 +37506,9 @@ const ssrInjectFallthroughAttrs = (node, context) => {
|
|
|
37462
37506
|
return;
|
|
37463
37507
|
}
|
|
37464
37508
|
if (node.type === 10 && hasSingleChild(node)) {
|
|
37465
|
-
|
|
37466
|
-
|
|
37467
|
-
if (c.type === 9 || c.type === 1 && findDir$1(c, "if")) {
|
|
37468
|
-
if (hasEncounteredIf) return;
|
|
37469
|
-
hasEncounteredIf = true;
|
|
37470
|
-
} else if (
|
|
37471
|
-
// node before v-if
|
|
37472
|
-
!hasEncounteredIf || // non else nodes
|
|
37473
|
-
!(c.type === 1 && findDir$1(c, /else/, true))
|
|
37474
|
-
) {
|
|
37475
|
-
return;
|
|
37476
|
-
}
|
|
37509
|
+
if (isSingleIfBlock(parent)) {
|
|
37510
|
+
injectFallthroughAttrs(node.children[0]);
|
|
37477
37511
|
}
|
|
37478
|
-
injectFallthroughAttrs(node.children[0]);
|
|
37479
37512
|
} else if (hasSingleChild(parent)) {
|
|
37480
37513
|
injectFallthroughAttrs(node);
|
|
37481
37514
|
}
|
|
@@ -54517,7 +54550,7 @@ const ${normalScriptDefaultVar} = ${defaultSpecifier.local.name}
|
|
|
54517
54550
|
}
|
|
54518
54551
|
if (sfc.cssVars.length && // no need to do this when targeting SSR
|
|
54519
54552
|
!ssr) {
|
|
54520
|
-
ctx.helperImports.add(
|
|
54553
|
+
ctx.helperImports.add(getCssVarsHelper(vapor));
|
|
54521
54554
|
ctx.helperImports.add("unref");
|
|
54522
54555
|
ctx.s.prependLeft(
|
|
54523
54556
|
startOffset,
|
|
@@ -54526,7 +54559,8 @@ ${genCssVarsCode(
|
|
|
54526
54559
|
sfc.cssVars,
|
|
54527
54560
|
ctx.bindingMetadata,
|
|
54528
54561
|
scopeId,
|
|
54529
|
-
!!options.isProd
|
|
54562
|
+
!!options.isProd,
|
|
54563
|
+
vapor
|
|
54530
54564
|
)}
|
|
54531
54565
|
`
|
|
54532
54566
|
);
|
|
@@ -54948,7 +54982,7 @@ var __spreadValues = (a, b) => {
|
|
|
54948
54982
|
}
|
|
54949
54983
|
return a;
|
|
54950
54984
|
};
|
|
54951
|
-
const version = "3.6.0-alpha.
|
|
54985
|
+
const version = "3.6.0-alpha.5";
|
|
54952
54986
|
const parseCache = parseCache$1;
|
|
54953
54987
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
54954
54988
|
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-alpha.
|
|
3
|
+
"version": "3.6.0-alpha.5",
|
|
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-alpha.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-vapor": "3.6.0-alpha.
|
|
53
|
-
"@vue/compiler-
|
|
54
|
-
"@vue/shared": "3.6.0-alpha.
|
|
50
|
+
"@vue/compiler-core": "3.6.0-alpha.5",
|
|
51
|
+
"@vue/compiler-ssr": "3.6.0-alpha.5",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-alpha.5",
|
|
53
|
+
"@vue/compiler-dom": "3.6.0-alpha.5",
|
|
54
|
+
"@vue/shared": "3.6.0-alpha.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.28.5",
|