@vue/compiler-sfc 3.6.0-alpha.5 → 3.6.0-alpha.6
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 +2 -2
- package/dist/compiler-sfc.esm-browser.js +244 -165
- 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.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -21756,7 +21756,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
21756
21756
|
return generator.toJSON();
|
|
21757
21757
|
}
|
|
21758
21758
|
|
|
21759
|
-
const version = "3.6.0-alpha.
|
|
21759
|
+
const version = "3.6.0-alpha.6";
|
|
21760
21760
|
const parseCache = parseCache$1;
|
|
21761
21761
|
const errorMessages = {
|
|
21762
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.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -26037,7 +26037,9 @@ const isNonKeyModifier = /* @__PURE__ */ makeMap(
|
|
|
26037
26037
|
`stop,prevent,self,ctrl,shift,alt,meta,exact,middle`
|
|
26038
26038
|
);
|
|
26039
26039
|
const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right");
|
|
26040
|
-
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
|
26040
|
+
const isKeyboardEvent = /* @__PURE__ */ makeMap(
|
|
26041
|
+
`onkeyup,onkeydown,onkeypress`
|
|
26042
|
+
);
|
|
26041
26043
|
const resolveModifiers = (key, modifiers, context, loc) => {
|
|
26042
26044
|
const keyModifiers = [];
|
|
26043
26045
|
const nonKeyModifiers = [];
|
|
@@ -26766,6 +26768,7 @@ var CompilerDOM = /*#__PURE__*/Object.freeze({
|
|
|
26766
26768
|
isFunctionType: isFunctionType,
|
|
26767
26769
|
isInDestructureAssignment: isInDestructureAssignment,
|
|
26768
26770
|
isInNewExpression: isInNewExpression,
|
|
26771
|
+
isKeyboardEvent: isKeyboardEvent,
|
|
26769
26772
|
isLiteralWhitelisted: isLiteralWhitelisted,
|
|
26770
26773
|
isMemberExpression: isMemberExpression$1,
|
|
26771
26774
|
isMemberExpressionBrowser: isMemberExpressionBrowser,
|
|
@@ -32058,8 +32061,7 @@ const newBlock = (node) => ({
|
|
|
32058
32061
|
effect: [],
|
|
32059
32062
|
operation: [],
|
|
32060
32063
|
returns: [],
|
|
32061
|
-
tempId: 0
|
|
32062
|
-
hasDeferredVShow: false
|
|
32064
|
+
tempId: 0
|
|
32063
32065
|
});
|
|
32064
32066
|
function wrapTemplate(node, dirs) {
|
|
32065
32067
|
if (node.tagType === 3) {
|
|
@@ -32320,7 +32322,8 @@ function transform(node, options = {}) {
|
|
|
32320
32322
|
component: /* @__PURE__ */ new Set(),
|
|
32321
32323
|
directive: /* @__PURE__ */ new Set(),
|
|
32322
32324
|
block: newBlock(node),
|
|
32323
|
-
hasTemplateRef: false
|
|
32325
|
+
hasTemplateRef: false,
|
|
32326
|
+
hasDeferredVShow: false
|
|
32324
32327
|
};
|
|
32325
32328
|
const context = new TransformContext(ir, node, options);
|
|
32326
32329
|
transformNode(context);
|
|
@@ -33061,7 +33064,7 @@ function genSetEvent(oper, context) {
|
|
|
33061
33064
|
const name = genName();
|
|
33062
33065
|
const handler = [
|
|
33063
33066
|
`${context.helper("createInvoker")}(`,
|
|
33064
|
-
...genEventHandler(context, value, modifiers),
|
|
33067
|
+
...genEventHandler(context, [value], modifiers),
|
|
33065
33068
|
`)`
|
|
33066
33069
|
];
|
|
33067
33070
|
const eventOptions = genEventOptions();
|
|
@@ -33118,37 +33121,47 @@ function genSetDynamicEvents(oper, context) {
|
|
|
33118
33121
|
)
|
|
33119
33122
|
];
|
|
33120
33123
|
}
|
|
33121
|
-
function genEventHandler(context,
|
|
33122
|
-
let handlerExp = [
|
|
33123
|
-
if (
|
|
33124
|
-
|
|
33125
|
-
|
|
33126
|
-
if (
|
|
33127
|
-
|
|
33128
|
-
|
|
33129
|
-
|
|
33130
|
-
|
|
33131
|
-
|
|
33132
|
-
|
|
33133
|
-
|
|
33134
|
-
|
|
33135
|
-
|
|
33136
|
-
|
|
33137
|
-
|
|
33138
|
-
|
|
33139
|
-
|
|
33140
|
-
|
|
33141
|
-
|
|
33142
|
-
|
|
33143
|
-
|
|
33144
|
-
|
|
33145
|
-
|
|
33146
|
-
|
|
33147
|
-
|
|
33148
|
-
|
|
33149
|
-
|
|
33124
|
+
function genEventHandler(context, values, modifiers = { nonKeys: [], keys: [] }, extraWrap = false) {
|
|
33125
|
+
let handlerExp = [];
|
|
33126
|
+
if (values) {
|
|
33127
|
+
values.forEach((value, index) => {
|
|
33128
|
+
let exp = [];
|
|
33129
|
+
if (value && value.content.trim()) {
|
|
33130
|
+
if (isMemberExpression$1(value, context.options)) {
|
|
33131
|
+
exp = genExpression(value, context);
|
|
33132
|
+
if (!isConstantBinding(value, context) && !extraWrap) {
|
|
33133
|
+
const isTSNode = value.ast && TS_NODE_TYPES.includes(value.ast.type);
|
|
33134
|
+
exp = [
|
|
33135
|
+
`e => `,
|
|
33136
|
+
isTSNode ? "(" : "",
|
|
33137
|
+
...exp,
|
|
33138
|
+
isTSNode ? ")" : "",
|
|
33139
|
+
`(e)`
|
|
33140
|
+
];
|
|
33141
|
+
}
|
|
33142
|
+
} else if (isFnExpression(value, context.options)) {
|
|
33143
|
+
exp = genExpression(value, context);
|
|
33144
|
+
} else {
|
|
33145
|
+
const referencesEvent = value.content.includes("$event");
|
|
33146
|
+
const hasMultipleStatements = value.content.includes(`;`);
|
|
33147
|
+
const expr = referencesEvent ? context.withId(() => genExpression(value, context), {
|
|
33148
|
+
$event: null
|
|
33149
|
+
}) : genExpression(value, context);
|
|
33150
|
+
exp = [
|
|
33151
|
+
referencesEvent ? "$event => " : "() => ",
|
|
33152
|
+
hasMultipleStatements ? "{" : "(",
|
|
33153
|
+
...expr,
|
|
33154
|
+
hasMultipleStatements ? "}" : ")"
|
|
33155
|
+
];
|
|
33156
|
+
}
|
|
33157
|
+
handlerExp = handlerExp.concat([index !== 0 ? ", " : "", ...exp]);
|
|
33158
|
+
}
|
|
33159
|
+
});
|
|
33160
|
+
if (values.length > 1) {
|
|
33161
|
+
handlerExp = ["[", ...handlerExp, "]"];
|
|
33150
33162
|
}
|
|
33151
33163
|
}
|
|
33164
|
+
if (handlerExp.length === 0) handlerExp = ["() => {}"];
|
|
33152
33165
|
const { keys, nonKeys } = modifiers;
|
|
33153
33166
|
if (nonKeys.length)
|
|
33154
33167
|
handlerExp = genWithModifiers(context, handlerExp, nonKeys);
|
|
@@ -33189,35 +33202,19 @@ function genFor(oper, context) {
|
|
|
33189
33202
|
component,
|
|
33190
33203
|
onlyChild
|
|
33191
33204
|
} = oper;
|
|
33192
|
-
|
|
33205
|
+
const rawValue = value && value.content;
|
|
33193
33206
|
const rawKey = key && key.content;
|
|
33194
33207
|
const rawIndex = index && index.content;
|
|
33195
33208
|
const sourceExpr = ["() => (", ...genExpression(source, context), ")"];
|
|
33196
|
-
const idToPathMap = parseValueDestructure();
|
|
33209
|
+
const idToPathMap = parseValueDestructure(value, context);
|
|
33197
33210
|
const [depth, exitScope] = context.enterScope();
|
|
33198
|
-
const idMap = {};
|
|
33199
33211
|
const itemVar = `_for_item${depth}`;
|
|
33212
|
+
const idMap = buildDestructureIdMap(
|
|
33213
|
+
idToPathMap,
|
|
33214
|
+
`${itemVar}.value`,
|
|
33215
|
+
context.options.expressionPlugins
|
|
33216
|
+
);
|
|
33200
33217
|
idMap[itemVar] = null;
|
|
33201
|
-
idToPathMap.forEach((pathInfo, id2) => {
|
|
33202
|
-
let path = `${itemVar}.value${pathInfo ? pathInfo.path : ""}`;
|
|
33203
|
-
if (pathInfo) {
|
|
33204
|
-
if (pathInfo.helper) {
|
|
33205
|
-
idMap[pathInfo.helper] = null;
|
|
33206
|
-
path = `${pathInfo.helper}(${path}, ${pathInfo.helperArgs})`;
|
|
33207
|
-
}
|
|
33208
|
-
if (pathInfo.dynamic) {
|
|
33209
|
-
const node = idMap[id2] = createSimpleExpression(path);
|
|
33210
|
-
const plugins = context.options.expressionPlugins;
|
|
33211
|
-
node.ast = libExports.parseExpression(`(${path})`, {
|
|
33212
|
-
plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
|
|
33213
|
-
});
|
|
33214
|
-
} else {
|
|
33215
|
-
idMap[id2] = path;
|
|
33216
|
-
}
|
|
33217
|
-
} else {
|
|
33218
|
-
idMap[id2] = path;
|
|
33219
|
-
}
|
|
33220
|
-
});
|
|
33221
33218
|
const args = [itemVar];
|
|
33222
33219
|
if (rawKey) {
|
|
33223
33220
|
const keyVar = `_for_key${depth}`;
|
|
@@ -33315,77 +33312,6 @@ function genFor(oper, context) {
|
|
|
33315
33312
|
// todo: hydrationNode
|
|
33316
33313
|
)
|
|
33317
33314
|
];
|
|
33318
|
-
function parseValueDestructure() {
|
|
33319
|
-
const map = /* @__PURE__ */ new Map();
|
|
33320
|
-
if (value) {
|
|
33321
|
-
rawValue = value && value.content;
|
|
33322
|
-
if (value.ast) {
|
|
33323
|
-
walkIdentifiers(
|
|
33324
|
-
value.ast,
|
|
33325
|
-
(id2, _, parentStack, ___, isLocal) => {
|
|
33326
|
-
if (isLocal) {
|
|
33327
|
-
let path = "";
|
|
33328
|
-
let isDynamic = false;
|
|
33329
|
-
let helper2;
|
|
33330
|
-
let helperArgs;
|
|
33331
|
-
for (let i = 0; i < parentStack.length; i++) {
|
|
33332
|
-
const parent = parentStack[i];
|
|
33333
|
-
const child = parentStack[i + 1] || id2;
|
|
33334
|
-
if (parent.type === "ObjectProperty" && parent.value === child) {
|
|
33335
|
-
if (parent.key.type === "StringLiteral") {
|
|
33336
|
-
path += `[${JSON.stringify(parent.key.value)}]`;
|
|
33337
|
-
} else if (parent.computed) {
|
|
33338
|
-
isDynamic = true;
|
|
33339
|
-
path += `[${value.content.slice(
|
|
33340
|
-
parent.key.start - 1,
|
|
33341
|
-
parent.key.end - 1
|
|
33342
|
-
)}]`;
|
|
33343
|
-
} else {
|
|
33344
|
-
path += `.${parent.key.name}`;
|
|
33345
|
-
}
|
|
33346
|
-
} else if (parent.type === "ArrayPattern") {
|
|
33347
|
-
const index2 = parent.elements.indexOf(child);
|
|
33348
|
-
if (child.type === "RestElement") {
|
|
33349
|
-
path += `.slice(${index2})`;
|
|
33350
|
-
} else {
|
|
33351
|
-
path += `[${index2}]`;
|
|
33352
|
-
}
|
|
33353
|
-
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
33354
|
-
helper2 = context.helper("getRestElement");
|
|
33355
|
-
helperArgs = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
33356
|
-
if (p.key.type === "StringLiteral") {
|
|
33357
|
-
return JSON.stringify(p.key.value);
|
|
33358
|
-
} else if (p.computed) {
|
|
33359
|
-
isDynamic = true;
|
|
33360
|
-
return value.content.slice(
|
|
33361
|
-
p.key.start - 1,
|
|
33362
|
-
p.key.end - 1
|
|
33363
|
-
);
|
|
33364
|
-
} else {
|
|
33365
|
-
return JSON.stringify(p.key.name);
|
|
33366
|
-
}
|
|
33367
|
-
}).join(", ") + "]";
|
|
33368
|
-
}
|
|
33369
|
-
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
33370
|
-
isDynamic = true;
|
|
33371
|
-
helper2 = context.helper("getDefaultValue");
|
|
33372
|
-
helperArgs = value.content.slice(
|
|
33373
|
-
child.right.start - 1,
|
|
33374
|
-
child.right.end - 1
|
|
33375
|
-
);
|
|
33376
|
-
}
|
|
33377
|
-
}
|
|
33378
|
-
map.set(id2.name, { path, dynamic: isDynamic, helper: helper2, helperArgs });
|
|
33379
|
-
}
|
|
33380
|
-
},
|
|
33381
|
-
true
|
|
33382
|
-
);
|
|
33383
|
-
} else {
|
|
33384
|
-
map.set(rawValue, null);
|
|
33385
|
-
}
|
|
33386
|
-
}
|
|
33387
|
-
return map;
|
|
33388
|
-
}
|
|
33389
33315
|
function genCallback(expr) {
|
|
33390
33316
|
if (!expr) return false;
|
|
33391
33317
|
const res = context.withId(
|
|
@@ -33412,6 +33338,98 @@ function genFor(oper, context) {
|
|
|
33412
33338
|
return idMap2;
|
|
33413
33339
|
}
|
|
33414
33340
|
}
|
|
33341
|
+
function parseValueDestructure(value, context) {
|
|
33342
|
+
const map = /* @__PURE__ */ new Map();
|
|
33343
|
+
if (value) {
|
|
33344
|
+
const rawValue = value.content;
|
|
33345
|
+
if (value.ast) {
|
|
33346
|
+
walkIdentifiers(
|
|
33347
|
+
value.ast,
|
|
33348
|
+
(id, _, parentStack, ___, isLocal) => {
|
|
33349
|
+
if (isLocal) {
|
|
33350
|
+
let path = "";
|
|
33351
|
+
let isDynamic = false;
|
|
33352
|
+
let helper;
|
|
33353
|
+
let helperArgs;
|
|
33354
|
+
for (let i = 0; i < parentStack.length; i++) {
|
|
33355
|
+
const parent = parentStack[i];
|
|
33356
|
+
const child = parentStack[i + 1] || id;
|
|
33357
|
+
if (parent.type === "ObjectProperty" && parent.value === child) {
|
|
33358
|
+
if (parent.key.type === "StringLiteral") {
|
|
33359
|
+
path += `[${JSON.stringify(parent.key.value)}]`;
|
|
33360
|
+
} else if (parent.computed) {
|
|
33361
|
+
isDynamic = true;
|
|
33362
|
+
path += `[${rawValue.slice(
|
|
33363
|
+
parent.key.start - 1,
|
|
33364
|
+
parent.key.end - 1
|
|
33365
|
+
)}]`;
|
|
33366
|
+
} else {
|
|
33367
|
+
path += `.${parent.key.name}`;
|
|
33368
|
+
}
|
|
33369
|
+
} else if (parent.type === "ArrayPattern") {
|
|
33370
|
+
const index = parent.elements.indexOf(child);
|
|
33371
|
+
if (child.type === "RestElement") {
|
|
33372
|
+
path += `.slice(${index})`;
|
|
33373
|
+
} else {
|
|
33374
|
+
path += `[${index}]`;
|
|
33375
|
+
}
|
|
33376
|
+
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
33377
|
+
helper = context.helper("getRestElement");
|
|
33378
|
+
helperArgs = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
33379
|
+
if (p.key.type === "StringLiteral") {
|
|
33380
|
+
return JSON.stringify(p.key.value);
|
|
33381
|
+
} else if (p.computed) {
|
|
33382
|
+
isDynamic = true;
|
|
33383
|
+
return rawValue.slice(p.key.start - 1, p.key.end - 1);
|
|
33384
|
+
} else {
|
|
33385
|
+
return JSON.stringify(p.key.name);
|
|
33386
|
+
}
|
|
33387
|
+
}).join(", ") + "]";
|
|
33388
|
+
}
|
|
33389
|
+
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
33390
|
+
isDynamic = true;
|
|
33391
|
+
helper = context.helper("getDefaultValue");
|
|
33392
|
+
helperArgs = rawValue.slice(
|
|
33393
|
+
child.right.start - 1,
|
|
33394
|
+
child.right.end - 1
|
|
33395
|
+
);
|
|
33396
|
+
}
|
|
33397
|
+
}
|
|
33398
|
+
map.set(id.name, { path, dynamic: isDynamic, helper, helperArgs });
|
|
33399
|
+
}
|
|
33400
|
+
},
|
|
33401
|
+
true
|
|
33402
|
+
);
|
|
33403
|
+
} else if (rawValue) {
|
|
33404
|
+
map.set(rawValue, null);
|
|
33405
|
+
}
|
|
33406
|
+
}
|
|
33407
|
+
return map;
|
|
33408
|
+
}
|
|
33409
|
+
function buildDestructureIdMap(idToPathMap, baseAccessor, plugins) {
|
|
33410
|
+
const idMap = {};
|
|
33411
|
+
idToPathMap.forEach((pathInfo, id) => {
|
|
33412
|
+
let path = baseAccessor;
|
|
33413
|
+
if (pathInfo) {
|
|
33414
|
+
path = `${baseAccessor}${pathInfo.path}`;
|
|
33415
|
+
if (pathInfo.helper) {
|
|
33416
|
+
idMap[pathInfo.helper] = null;
|
|
33417
|
+
path = pathInfo.helperArgs ? `${pathInfo.helper}(${path}, ${pathInfo.helperArgs})` : `${pathInfo.helper}(${path})`;
|
|
33418
|
+
}
|
|
33419
|
+
if (pathInfo.dynamic) {
|
|
33420
|
+
const node = idMap[id] = createSimpleExpression(path);
|
|
33421
|
+
node.ast = libExports.parseExpression(`(${path})`, {
|
|
33422
|
+
plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
|
|
33423
|
+
});
|
|
33424
|
+
} else {
|
|
33425
|
+
idMap[id] = path;
|
|
33426
|
+
}
|
|
33427
|
+
} else {
|
|
33428
|
+
idMap[id] = path;
|
|
33429
|
+
}
|
|
33430
|
+
});
|
|
33431
|
+
return idMap;
|
|
33432
|
+
}
|
|
33415
33433
|
function matchPatterns(render, keyProp, idMap) {
|
|
33416
33434
|
const selectorPatterns = [];
|
|
33417
33435
|
const keyOnlyBindingPatterns = [];
|
|
@@ -33652,6 +33670,7 @@ function genPropKey({ key: node, modifier, runtimeCamelize, handler, handlerModi
|
|
|
33652
33670
|
}
|
|
33653
33671
|
let key = genExpression(node, context);
|
|
33654
33672
|
if (runtimeCamelize) {
|
|
33673
|
+
key.push(' || ""');
|
|
33655
33674
|
key = genCall(helper("camelize"), key);
|
|
33656
33675
|
}
|
|
33657
33676
|
if (handler) {
|
|
@@ -33893,7 +33912,7 @@ function genCreateComponent(operation, context) {
|
|
|
33893
33912
|
const rawProps = context.withId(() => genRawProps(props, context), ids);
|
|
33894
33913
|
const inlineHandlers = handlers.reduce(
|
|
33895
33914
|
(acc, { name, value }) => {
|
|
33896
|
-
const handler = genEventHandler(context, value, void 0, false);
|
|
33915
|
+
const handler = genEventHandler(context, [value], void 0, false);
|
|
33897
33916
|
return [...acc, `const ${name} = `, ...handler, NEWLINE];
|
|
33898
33917
|
},
|
|
33899
33918
|
[]
|
|
@@ -34027,7 +34046,7 @@ function genProp(prop, context, isStatic) {
|
|
|
34027
34046
|
": ",
|
|
34028
34047
|
...prop.handler ? genEventHandler(
|
|
34029
34048
|
context,
|
|
34030
|
-
prop.values
|
|
34049
|
+
prop.values,
|
|
34031
34050
|
prop.handlerModifiers,
|
|
34032
34051
|
true
|
|
34033
34052
|
) : isStatic ? ["() => (", ...values, ")"] : values,
|
|
@@ -34155,35 +34174,29 @@ function genConditionalSlot(slot, context) {
|
|
|
34155
34174
|
];
|
|
34156
34175
|
}
|
|
34157
34176
|
function genSlotBlockWithProps(oper, context) {
|
|
34158
|
-
let isDestructureAssignment = false;
|
|
34159
|
-
let rawProps;
|
|
34160
34177
|
let propsName;
|
|
34161
34178
|
let exitScope;
|
|
34162
34179
|
let depth;
|
|
34163
34180
|
const { props, key, node } = oper;
|
|
34164
|
-
const
|
|
34181
|
+
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
34165
34182
|
if (props) {
|
|
34166
|
-
|
|
34167
|
-
if (isDestructureAssignment = !!props.ast) {
|
|
34183
|
+
if (props.ast) {
|
|
34168
34184
|
[depth, exitScope] = context.enterScope();
|
|
34169
34185
|
propsName = `_slotProps${depth}`;
|
|
34170
|
-
walkIdentifiers(
|
|
34171
|
-
props.ast,
|
|
34172
|
-
(id, _, __, ___, isLocal) => {
|
|
34173
|
-
if (isLocal) idsOfProps.add(id.name);
|
|
34174
|
-
},
|
|
34175
|
-
true
|
|
34176
|
-
);
|
|
34177
34186
|
} else {
|
|
34178
|
-
|
|
34187
|
+
propsName = props.content;
|
|
34179
34188
|
}
|
|
34180
34189
|
}
|
|
34181
|
-
const idMap =
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34190
|
+
const idMap = idToPathMap.size ? buildDestructureIdMap(
|
|
34191
|
+
idToPathMap,
|
|
34192
|
+
propsName || "",
|
|
34193
|
+
context.options.expressionPlugins
|
|
34194
|
+
) : {};
|
|
34195
|
+
if (propsName) {
|
|
34196
|
+
idMap[propsName] = null;
|
|
34197
|
+
}
|
|
34185
34198
|
let blockFn = context.withId(
|
|
34186
|
-
() => genBlock(oper, context, [propsName]),
|
|
34199
|
+
() => genBlock(oper, context, propsName ? [propsName] : []),
|
|
34187
34200
|
idMap
|
|
34188
34201
|
);
|
|
34189
34202
|
exitScope && exitScope();
|
|
@@ -34203,15 +34216,70 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
34203
34216
|
`}`
|
|
34204
34217
|
];
|
|
34205
34218
|
}
|
|
34206
|
-
if (node.type === 1
|
|
34207
|
-
|
|
34219
|
+
if (node.type === 1) {
|
|
34220
|
+
if (needsVaporCtx(oper)) {
|
|
34221
|
+
blockFn = [`${context.helper("withVaporCtx")}(`, ...blockFn, `)`];
|
|
34222
|
+
}
|
|
34208
34223
|
}
|
|
34209
34224
|
return blockFn;
|
|
34210
34225
|
}
|
|
34226
|
+
function needsVaporCtx(block) {
|
|
34227
|
+
return hasComponentOrSlotInBlock(block);
|
|
34228
|
+
}
|
|
34229
|
+
function hasComponentOrSlotInBlock(block) {
|
|
34230
|
+
if (hasComponentOrSlotInOperations(block.operation)) return true;
|
|
34231
|
+
return hasComponentOrSlotInDynamic(block.dynamic);
|
|
34232
|
+
}
|
|
34233
|
+
function hasComponentOrSlotInDynamic(dynamic) {
|
|
34234
|
+
if (dynamic.operation) {
|
|
34235
|
+
const type = dynamic.operation.type;
|
|
34236
|
+
if (type === 11 || type === 12) {
|
|
34237
|
+
return true;
|
|
34238
|
+
}
|
|
34239
|
+
if (type === 15) {
|
|
34240
|
+
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
34241
|
+
}
|
|
34242
|
+
if (type === 16) {
|
|
34243
|
+
if (hasComponentOrSlotInBlock(dynamic.operation.render))
|
|
34244
|
+
return true;
|
|
34245
|
+
}
|
|
34246
|
+
}
|
|
34247
|
+
for (const child of dynamic.children) {
|
|
34248
|
+
if (hasComponentOrSlotInDynamic(child)) return true;
|
|
34249
|
+
}
|
|
34250
|
+
return false;
|
|
34251
|
+
}
|
|
34252
|
+
function hasComponentOrSlotInOperations(operations) {
|
|
34253
|
+
for (const op of operations) {
|
|
34254
|
+
switch (op.type) {
|
|
34255
|
+
case 11:
|
|
34256
|
+
case 12:
|
|
34257
|
+
return true;
|
|
34258
|
+
case 15:
|
|
34259
|
+
if (hasComponentOrSlotInIf(op)) return true;
|
|
34260
|
+
break;
|
|
34261
|
+
case 16:
|
|
34262
|
+
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
34263
|
+
break;
|
|
34264
|
+
}
|
|
34265
|
+
}
|
|
34266
|
+
return false;
|
|
34267
|
+
}
|
|
34268
|
+
function hasComponentOrSlotInIf(node) {
|
|
34269
|
+
if (hasComponentOrSlotInBlock(node.positive)) return true;
|
|
34270
|
+
if (node.negative) {
|
|
34271
|
+
if ("positive" in node.negative) {
|
|
34272
|
+
return hasComponentOrSlotInIf(node.negative);
|
|
34273
|
+
} else {
|
|
34274
|
+
return hasComponentOrSlotInBlock(node.negative);
|
|
34275
|
+
}
|
|
34276
|
+
}
|
|
34277
|
+
return false;
|
|
34278
|
+
}
|
|
34211
34279
|
|
|
34212
34280
|
function genSlotOutlet(oper, context) {
|
|
34213
34281
|
const { helper } = context;
|
|
34214
|
-
const { id, name, fallback, noSlotted } = oper;
|
|
34282
|
+
const { id, name, fallback, noSlotted, once } = oper;
|
|
34215
34283
|
const [frag, push] = buildCodeFragment();
|
|
34216
34284
|
const nameExpr = name.isStatic ? genExpression(name, context) : ["() => (", ...genExpression(name, context), ")"];
|
|
34217
34285
|
let fallbackArg;
|
|
@@ -34226,8 +34294,10 @@ function genSlotOutlet(oper, context) {
|
|
|
34226
34294
|
nameExpr,
|
|
34227
34295
|
genRawProps(oper.props, context) || "null",
|
|
34228
34296
|
fallbackArg,
|
|
34229
|
-
noSlotted && "true"
|
|
34297
|
+
noSlotted && "true",
|
|
34230
34298
|
// noSlotted
|
|
34299
|
+
once && "true"
|
|
34300
|
+
// v-once
|
|
34231
34301
|
)
|
|
34232
34302
|
);
|
|
34233
34303
|
return frag;
|
|
@@ -34477,9 +34547,6 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
34477
34547
|
const [frag, push] = buildCodeFragment();
|
|
34478
34548
|
const { dynamic, effect, operation, returns, key } = block;
|
|
34479
34549
|
const resetBlock = context.enterBlock(block);
|
|
34480
|
-
if (block.hasDeferredVShow) {
|
|
34481
|
-
push(NEWLINE, `const deferredApplyVShows = []`);
|
|
34482
|
-
}
|
|
34483
34550
|
if (root) {
|
|
34484
34551
|
for (let name of context.ir.component) {
|
|
34485
34552
|
const id = toValidAssetId(name, "component");
|
|
@@ -34508,7 +34575,7 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
34508
34575
|
}
|
|
34509
34576
|
push(...genOperations(operation, context));
|
|
34510
34577
|
push(...genEffects(effect, context, genEffectsExtraFrag));
|
|
34511
|
-
if (
|
|
34578
|
+
if (root && context.ir.hasDeferredVShow) {
|
|
34512
34579
|
push(NEWLINE, `deferredApplyVShows.forEach(fn => fn())`);
|
|
34513
34580
|
}
|
|
34514
34581
|
if (dynamic.needsKey) {
|
|
@@ -34664,6 +34731,9 @@ function generate(ir, options = {}) {
|
|
|
34664
34731
|
`const ${setTemplateRefIdent} = ${context.helper("createTemplateRefSetter")}()`
|
|
34665
34732
|
);
|
|
34666
34733
|
}
|
|
34734
|
+
if (ir.hasDeferredVShow) {
|
|
34735
|
+
push(NEWLINE, `const deferredApplyVShows = []`);
|
|
34736
|
+
}
|
|
34667
34737
|
push(...genBlockContent(ir.block, context, true));
|
|
34668
34738
|
push(INDENT_END, NEWLINE);
|
|
34669
34739
|
if (!inline) {
|
|
@@ -34817,6 +34887,11 @@ const isReservedProp = /* @__PURE__ */ makeMap(
|
|
|
34817
34887
|
const transformElement = (node, context) => {
|
|
34818
34888
|
let effectIndex = context.block.effect.length;
|
|
34819
34889
|
const getEffectIndex = () => effectIndex++;
|
|
34890
|
+
let parentSlots;
|
|
34891
|
+
if (node.type === 1 && (node.tagType === 1 || context.options.isCustomElement(node.tag))) {
|
|
34892
|
+
parentSlots = context.slots;
|
|
34893
|
+
context.slots = [];
|
|
34894
|
+
}
|
|
34820
34895
|
return function postTransformElement() {
|
|
34821
34896
|
({ node } = context);
|
|
34822
34897
|
if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1)))
|
|
@@ -34850,6 +34925,9 @@ const transformElement = (node, context) => {
|
|
|
34850
34925
|
getEffectIndex
|
|
34851
34926
|
);
|
|
34852
34927
|
}
|
|
34928
|
+
if (parentSlots) {
|
|
34929
|
+
context.slots = parentSlots;
|
|
34930
|
+
}
|
|
34853
34931
|
};
|
|
34854
34932
|
};
|
|
34855
34933
|
function isSingleRoot(context) {
|
|
@@ -35124,7 +35202,7 @@ function dedupeProperties(results) {
|
|
|
35124
35202
|
const name = prop.key.content;
|
|
35125
35203
|
const existing = knownProps.get(name);
|
|
35126
35204
|
if (existing && existing.handler === prop.handler) {
|
|
35127
|
-
if (name === "style" || name === "class") {
|
|
35205
|
+
if (name === "style" || name === "class" || prop.handler) {
|
|
35128
35206
|
mergePropValues(existing, prop);
|
|
35129
35207
|
}
|
|
35130
35208
|
} else {
|
|
@@ -35289,6 +35367,9 @@ const transformVOn = (dir, node, context) => {
|
|
|
35289
35367
|
keyOverride = ["click", "contextmenu"];
|
|
35290
35368
|
}
|
|
35291
35369
|
}
|
|
35370
|
+
if (keyModifiers.length && isStaticExp(arg) && !isKeyboardEvent(`on${arg.content.toLowerCase()}`)) {
|
|
35371
|
+
keyModifiers.length = 0;
|
|
35372
|
+
}
|
|
35292
35373
|
if (isComponent || isSlotOutlet) {
|
|
35293
35374
|
const handler = exp || EMPTY_EXPRESSION;
|
|
35294
35375
|
return {
|
|
@@ -35342,7 +35423,7 @@ const transformVShow = (dir, node, context) => {
|
|
|
35342
35423
|
if (parentNode && parentNode.type === 1) {
|
|
35343
35424
|
shouldDeferred = !!(isTransitionTag(parentNode.tag) && findProp(parentNode, "appear", false, true));
|
|
35344
35425
|
if (shouldDeferred) {
|
|
35345
|
-
context.
|
|
35426
|
+
context.ir.hasDeferredVShow = true;
|
|
35346
35427
|
}
|
|
35347
35428
|
}
|
|
35348
35429
|
context.registerOperation({
|
|
@@ -35615,7 +35696,7 @@ function getSiblingIf(context, reverse) {
|
|
|
35615
35696
|
let i = siblings.indexOf(context.node);
|
|
35616
35697
|
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
35617
35698
|
sibling = siblings[i];
|
|
35618
|
-
if (!
|
|
35699
|
+
if (!isCommentOrWhitespace(sibling)) {
|
|
35619
35700
|
break;
|
|
35620
35701
|
}
|
|
35621
35702
|
}
|
|
@@ -35625,9 +35706,6 @@ function getSiblingIf(context, reverse) {
|
|
|
35625
35706
|
return sibling;
|
|
35626
35707
|
}
|
|
35627
35708
|
}
|
|
35628
|
-
function isCommentLike(node) {
|
|
35629
|
-
return node.type === 3 || node.type === 2 && !node.content.trim().length;
|
|
35630
|
-
}
|
|
35631
35709
|
|
|
35632
35710
|
const transformVIf = createStructuralDirectiveTransform(
|
|
35633
35711
|
["if", "else", "else-if"],
|
|
@@ -35851,7 +35929,8 @@ const transformSlotOutlet = (node, context) => {
|
|
|
35851
35929
|
name: slotName,
|
|
35852
35930
|
props: irProps,
|
|
35853
35931
|
fallback,
|
|
35854
|
-
noSlotted: !!(context.options.scopeId && !context.options.slotted)
|
|
35932
|
+
noSlotted: !!(context.options.scopeId && !context.options.slotted),
|
|
35933
|
+
once: context.inVOnce
|
|
35855
35934
|
};
|
|
35856
35935
|
};
|
|
35857
35936
|
};
|
|
@@ -54982,7 +55061,7 @@ var __spreadValues = (a, b) => {
|
|
|
54982
55061
|
}
|
|
54983
55062
|
return a;
|
|
54984
55063
|
};
|
|
54985
|
-
const version = "3.6.0-alpha.
|
|
55064
|
+
const version = "3.6.0-alpha.6";
|
|
54986
55065
|
const parseCache = parseCache$1;
|
|
54987
55066
|
const errorMessages = __spreadValues(__spreadValues({}, errorMessages$1), DOMErrorMessages);
|
|
54988
55067
|
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.6",
|
|
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.6",
|
|
51
|
+
"@vue/compiler-dom": "3.6.0-alpha.6",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-alpha.6",
|
|
53
|
+
"@vue/compiler-ssr": "3.6.0-alpha.6",
|
|
54
|
+
"@vue/shared": "3.6.0-alpha.6"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.28.5",
|