@vue/compiler-sfc 3.6.0-rc.3 → 3.6.0-rc.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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15879,7 +15879,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
15879
15879
|
}
|
|
15880
15880
|
//#endregion
|
|
15881
15881
|
//#region packages/compiler-sfc/src/index.ts
|
|
15882
|
-
const version = "3.6.0-rc.
|
|
15882
|
+
const version = "3.6.0-rc.5";
|
|
15883
15883
|
const parseCache = parseCache$1;
|
|
15884
15884
|
const errorMessages = {
|
|
15885
15885
|
..._vue_compiler_dom.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25185,7 +25185,7 @@ var TransformContext = class TransformContext {
|
|
|
25185
25185
|
isSingleRootChild(childInfo) {
|
|
25186
25186
|
if (this.inVFor || !childInfo.hasSingleRootChild) return false;
|
|
25187
25187
|
if (this.node.type === 0) return true;
|
|
25188
|
-
return this.node.type === 1 && this.node.tagType === 3 && !!this.parent && this.isSingleRoot;
|
|
25188
|
+
return this.node.type === 1 && (this.node.tagType === 3 || isTransitionNode(this.node)) && !!this.parent && this.isSingleRoot;
|
|
25189
25189
|
}
|
|
25190
25190
|
};
|
|
25191
25191
|
function hasSingleRootChild(children) {
|
|
@@ -26668,7 +26668,7 @@ function getSpecialHelper(keyName, tagName, isSVG) {
|
|
|
26668
26668
|
const setTemplateRefIdent = `_setTemplateRef`;
|
|
26669
26669
|
function genSetTemplateRef(oper, context) {
|
|
26670
26670
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
26671
|
-
if (
|
|
26671
|
+
if (!oper.effect && !oper.refFor && oper.value.isStatic) return genSetStaticTemplateRef(oper, refValue, refKey, context);
|
|
26672
26672
|
context.needsTemplateRefSetter = true;
|
|
26673
26673
|
return [NEWLINE, ...genCall(setTemplateRefIdent, `n${oper.element}`, refValue, oper.refFor && "true", refKey)];
|
|
26674
26674
|
}
|
|
@@ -26677,13 +26677,7 @@ function genSetStaticTemplateRef(oper, refValue, refKey, context) {
|
|
|
26677
26677
|
}
|
|
26678
26678
|
function genSetTemplateRefBinding(oper, context) {
|
|
26679
26679
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
26680
|
-
|
|
26681
|
-
if (context.inSlotBlock) context.needsTemplateRefSetter = true;
|
|
26682
|
-
return [NEWLINE, ...genCall([context.helper("setTemplateRefBinding"), "undefined"], `n${oper.element}`, ["() => ", ...refValue], ...setter || oper.refFor || refKey ? [
|
|
26683
|
-
setter,
|
|
26684
|
-
oper.refFor && "true",
|
|
26685
|
-
refKey
|
|
26686
|
-
] : [])];
|
|
26680
|
+
return [NEWLINE, ...genCall([context.helper("setTemplateRefBinding"), "undefined"], `n${oper.element}`, ["() => ", ...refValue], ...oper.refFor || refKey ? [oper.refFor && "true", refKey] : [])];
|
|
26687
26681
|
}
|
|
26688
26682
|
function genRefValue(value, context) {
|
|
26689
26683
|
if (value && context.options.inline) {
|
|
@@ -27100,7 +27094,7 @@ function genStaticSlots({ slots }, context, dynamicSlots) {
|
|
|
27100
27094
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ...args);
|
|
27101
27095
|
}
|
|
27102
27096
|
function genDynamicSlots(slots, context) {
|
|
27103
|
-
return genMulti(DELIMITERS_ARRAY_NEWLINE, ...slots.map((slot) => slot.slotType === 0 ? genStaticSlots(slot, context) : slot.slotType === 4 ? slot.slots.content : genDynamicSlot(slot, context,
|
|
27097
|
+
return genMulti(DELIMITERS_ARRAY_NEWLINE, ...slots.map((slot) => slot.slotType === 0 ? genStaticSlots(slot, context) : slot.slotType === 4 ? slot.slots.content : genDynamicSlot(slot, context, slot.slotType !== 2)));
|
|
27104
27098
|
}
|
|
27105
27099
|
function genDynamicSlot(slot, context, withFunction = false) {
|
|
27106
27100
|
let frag;
|
|
@@ -27127,26 +27121,65 @@ function genBasicDynamicSlot(slot, context) {
|
|
|
27127
27121
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context, false)]);
|
|
27128
27122
|
}
|
|
27129
27123
|
function genLoopSlot(slot, context) {
|
|
27130
|
-
const { name, fn, loop } = slot;
|
|
27124
|
+
const { name, fn, loop, keyProp } = slot;
|
|
27131
27125
|
const { value, key, index, source } = loop;
|
|
27132
27126
|
const rawValue = value && value.content;
|
|
27133
27127
|
const rawKey = key && key.content;
|
|
27134
27128
|
const rawIndex = index && index.content;
|
|
27135
|
-
const
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
-
|
|
27139
|
-
|
|
27140
|
-
|
|
27129
|
+
const idToPathMap = parseValueDestructure(value, context);
|
|
27130
|
+
const [depth, exitScope] = context.enterScope();
|
|
27131
|
+
const itemVar = `_for_item${depth}`;
|
|
27132
|
+
const idMap = buildDestructureIdMap(idToPathMap, `${itemVar}.value`, context.options.expressionPlugins);
|
|
27133
|
+
idMap[itemVar] = null;
|
|
27134
|
+
const args = [itemVar];
|
|
27135
|
+
if (rawKey) {
|
|
27136
|
+
const keyVar = `_for_key${depth}`;
|
|
27137
|
+
args.push(keyVar);
|
|
27138
|
+
idMap[rawKey] = `${keyVar}.value`;
|
|
27139
|
+
idMap[keyVar] = null;
|
|
27140
|
+
} else if (rawIndex) args.push("_");
|
|
27141
|
+
if (rawIndex) {
|
|
27142
|
+
const indexVar = `_for_index${depth}`;
|
|
27143
|
+
args.push(indexVar);
|
|
27144
|
+
idMap[rawIndex] = `${indexVar}.value`;
|
|
27145
|
+
idMap[indexVar] = null;
|
|
27146
|
+
}
|
|
27147
|
+
const renderSlot = [
|
|
27141
27148
|
...genMulti([
|
|
27142
27149
|
"(",
|
|
27143
27150
|
")",
|
|
27144
27151
|
", "
|
|
27145
|
-
],
|
|
27152
|
+
], ...args),
|
|
27153
|
+
" => ",
|
|
27154
|
+
...context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)
|
|
27155
|
+
];
|
|
27156
|
+
exitScope();
|
|
27157
|
+
const rawIdMap = {};
|
|
27158
|
+
if (rawKey) rawIdMap[rawKey] = null;
|
|
27159
|
+
if (rawIndex) rawIdMap[rawIndex] = null;
|
|
27160
|
+
idToPathMap.forEach((_, id) => rawIdMap[id] = null);
|
|
27161
|
+
const rawParams = genMulti([
|
|
27162
|
+
"(",
|
|
27163
|
+
")",
|
|
27164
|
+
", "
|
|
27165
|
+
], rawValue ? rawValue : rawKey || rawIndex ? "_" : void 0, rawKey ? rawKey : rawIndex ? "__" : void 0, rawIndex);
|
|
27166
|
+
const getName = [
|
|
27167
|
+
...rawParams,
|
|
27146
27168
|
" => (",
|
|
27147
|
-
...
|
|
27169
|
+
...context.withId(() => genExpression(name, context), rawIdMap),
|
|
27148
27170
|
")"
|
|
27149
|
-
]
|
|
27171
|
+
];
|
|
27172
|
+
const getKey = keyProp && [
|
|
27173
|
+
...rawParams,
|
|
27174
|
+
" => (",
|
|
27175
|
+
...context.withId(() => genExpression(keyProp, context), rawIdMap),
|
|
27176
|
+
")"
|
|
27177
|
+
];
|
|
27178
|
+
return [...genCall(context.helper("createForSlots"), [
|
|
27179
|
+
"() => (",
|
|
27180
|
+
...genExpression(source, context),
|
|
27181
|
+
")"
|
|
27182
|
+
], renderSlot, getName, getKey)];
|
|
27150
27183
|
}
|
|
27151
27184
|
function genConditionalSlot(slot, context) {
|
|
27152
27185
|
const { condition, positive, negative } = slot;
|
|
@@ -27858,7 +27891,6 @@ var CodegenContext = class {
|
|
|
27858
27891
|
this.block = ir.block;
|
|
27859
27892
|
this.bindingNames = new Set(this.options.bindingMetadata ? Object.keys(this.options.bindingMetadata) : []);
|
|
27860
27893
|
this.initNextIdMap();
|
|
27861
|
-
this.staticTemplateRefHelperCandidate = getStaticTemplateRefHelperCandidate(ir.block);
|
|
27862
27894
|
}
|
|
27863
27895
|
};
|
|
27864
27896
|
function generate(ir, options = {}) {
|
|
@@ -27910,11 +27942,6 @@ function genAssetImports({ ir }) {
|
|
|
27910
27942
|
}
|
|
27911
27943
|
return imports;
|
|
27912
27944
|
}
|
|
27913
|
-
function getStaticTemplateRefHelperCandidate(block) {
|
|
27914
|
-
if (block.operation.length !== 1) return;
|
|
27915
|
-
const operation = block.operation[0];
|
|
27916
|
-
if (operation.type === 9 && !operation.effect && !operation.refFor && operation.value.isStatic) return operation;
|
|
27917
|
-
}
|
|
27918
27945
|
//#endregion
|
|
27919
27946
|
//#region packages/compiler-vapor/src/transforms/vBind.ts
|
|
27920
27947
|
function normalizeBindShorthand(arg, context) {
|
|
@@ -28542,7 +28569,8 @@ function dedupeProperties(results) {
|
|
|
28542
28569
|
const name = prop.key.content;
|
|
28543
28570
|
const existing = knownProps.get(name);
|
|
28544
28571
|
if (existing && existing.handler === prop.handler) {
|
|
28545
|
-
if (
|
|
28572
|
+
if (prop.handler) deduped.push(prop);
|
|
28573
|
+
else if (name === "style" || name === "class") mergePropValues(existing, prop);
|
|
28546
28574
|
} else {
|
|
28547
28575
|
knownProps.set(name, prop);
|
|
28548
28576
|
deduped.push(prop);
|
|
@@ -29396,13 +29424,16 @@ function transformTemplateSlot(node, dir, context) {
|
|
|
29396
29424
|
};
|
|
29397
29425
|
ifNode.negative = negative;
|
|
29398
29426
|
} else context.options.onError(createCompilerError(30, vElse.loc));
|
|
29399
|
-
} else if (vFor) if (vFor.forParseResult)
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29427
|
+
} else if (vFor) if (vFor.forParseResult) {
|
|
29428
|
+
const keyProp = findProp(node, "key");
|
|
29429
|
+
registerDynamicSlot(slots, {
|
|
29430
|
+
slotType: 2,
|
|
29431
|
+
name: arg,
|
|
29432
|
+
fn: block,
|
|
29433
|
+
loop: vFor.forParseResult,
|
|
29434
|
+
keyProp: keyProp && propToExpression(keyProp)
|
|
29435
|
+
});
|
|
29436
|
+
} else context.options.onError(createCompilerError(32, vFor.loc));
|
|
29406
29437
|
return onExit;
|
|
29407
29438
|
}
|
|
29408
29439
|
function ensureStaticSlots(slots) {
|
|
@@ -43202,7 +43233,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
43202
43233
|
//#endregion
|
|
43203
43234
|
//#region packages/compiler-sfc/src/index.ts
|
|
43204
43235
|
init_objectSpread2();
|
|
43205
|
-
const version = "3.6.0-rc.
|
|
43236
|
+
const version = "3.6.0-rc.5";
|
|
43206
43237
|
const parseCache = parseCache$1;
|
|
43207
43238
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
43208
43239
|
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-rc.
|
|
3
|
+
"version": "3.6.0-rc.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.19",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-core": "3.6.0-rc.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-
|
|
53
|
-
"@vue/compiler-vapor": "3.6.0-rc.
|
|
54
|
-
"@vue/shared": "3.6.0-rc.
|
|
50
|
+
"@vue/compiler-core": "3.6.0-rc.5",
|
|
51
|
+
"@vue/compiler-dom": "3.6.0-rc.5",
|
|
52
|
+
"@vue/compiler-ssr": "3.6.0-rc.5",
|
|
53
|
+
"@vue/compiler-vapor": "3.6.0-rc.5",
|
|
54
|
+
"@vue/shared": "3.6.0-rc.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.29.8",
|