@vue/compiler-sfc 3.6.0-rc.3 → 3.6.0-rc.4

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-sfc v3.6.0-rc.3
2
+ * @vue/compiler-sfc v3.6.0-rc.4
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.3";
15882
+ const version = "3.6.0-rc.4";
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.3
2
+ * @vue/compiler-sfc v3.6.0-rc.4
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) {
@@ -27100,7 +27100,7 @@ function genStaticSlots({ slots }, context, dynamicSlots) {
27100
27100
  return genMulti(DELIMITERS_OBJECT_NEWLINE, ...args);
27101
27101
  }
27102
27102
  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, true)));
27103
+ 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
27104
  }
27105
27105
  function genDynamicSlot(slot, context, withFunction = false) {
27106
27106
  let frag;
@@ -27127,26 +27127,65 @@ function genBasicDynamicSlot(slot, context) {
27127
27127
  return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context, false)]);
27128
27128
  }
27129
27129
  function genLoopSlot(slot, context) {
27130
- const { name, fn, loop } = slot;
27130
+ const { name, fn, loop, keyProp } = slot;
27131
27131
  const { value, key, index, source } = loop;
27132
27132
  const rawValue = value && value.content;
27133
27133
  const rawKey = key && key.content;
27134
27134
  const rawIndex = index && index.content;
27135
- const idMap = {};
27136
- if (rawValue) idMap[rawValue] = rawValue;
27137
- if (rawKey) idMap[rawKey] = rawKey;
27138
- if (rawIndex) idMap[rawIndex] = rawIndex;
27139
- const slotExpr = genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...context.withId(() => genExpression(name, context), idMap)], ["fn: ", ...context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)]);
27140
- return [...genCall(context.helper("createForSlots"), genExpression(source, context), [
27135
+ const idToPathMap = parseValueDestructure(value, context);
27136
+ const [depth, exitScope] = context.enterScope();
27137
+ const itemVar = `_for_item${depth}`;
27138
+ const idMap = buildDestructureIdMap(idToPathMap, `${itemVar}.value`, context.options.expressionPlugins);
27139
+ idMap[itemVar] = null;
27140
+ const args = [itemVar];
27141
+ if (rawKey) {
27142
+ const keyVar = `_for_key${depth}`;
27143
+ args.push(keyVar);
27144
+ idMap[rawKey] = `${keyVar}.value`;
27145
+ idMap[keyVar] = null;
27146
+ } else if (rawIndex) args.push("_");
27147
+ if (rawIndex) {
27148
+ const indexVar = `_for_index${depth}`;
27149
+ args.push(indexVar);
27150
+ idMap[rawIndex] = `${indexVar}.value`;
27151
+ idMap[indexVar] = null;
27152
+ }
27153
+ const renderSlot = [
27141
27154
  ...genMulti([
27142
27155
  "(",
27143
27156
  ")",
27144
27157
  ", "
27145
- ], rawValue ? rawValue : rawKey || rawIndex ? "_" : void 0, rawKey ? rawKey : rawIndex ? "__" : void 0, rawIndex),
27158
+ ], ...args),
27159
+ " => ",
27160
+ ...context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)
27161
+ ];
27162
+ exitScope();
27163
+ const rawIdMap = {};
27164
+ if (rawKey) rawIdMap[rawKey] = null;
27165
+ if (rawIndex) rawIdMap[rawIndex] = null;
27166
+ idToPathMap.forEach((_, id) => rawIdMap[id] = null);
27167
+ const rawParams = genMulti([
27168
+ "(",
27169
+ ")",
27170
+ ", "
27171
+ ], rawValue ? rawValue : rawKey || rawIndex ? "_" : void 0, rawKey ? rawKey : rawIndex ? "__" : void 0, rawIndex);
27172
+ const getName = [
27173
+ ...rawParams,
27146
27174
  " => (",
27147
- ...slotExpr,
27175
+ ...context.withId(() => genExpression(name, context), rawIdMap),
27148
27176
  ")"
27149
- ])];
27177
+ ];
27178
+ const getKey = keyProp && [
27179
+ ...rawParams,
27180
+ " => (",
27181
+ ...context.withId(() => genExpression(keyProp, context), rawIdMap),
27182
+ ")"
27183
+ ];
27184
+ return [...genCall(context.helper("createForSlots"), [
27185
+ "() => (",
27186
+ ...genExpression(source, context),
27187
+ ")"
27188
+ ], renderSlot, getName, getKey)];
27150
27189
  }
27151
27190
  function genConditionalSlot(slot, context) {
27152
27191
  const { condition, positive, negative } = slot;
@@ -28542,7 +28581,8 @@ function dedupeProperties(results) {
28542
28581
  const name = prop.key.content;
28543
28582
  const existing = knownProps.get(name);
28544
28583
  if (existing && existing.handler === prop.handler) {
28545
- if (name === "style" || name === "class" || prop.handler) mergePropValues(existing, prop);
28584
+ if (prop.handler) deduped.push(prop);
28585
+ else if (name === "style" || name === "class") mergePropValues(existing, prop);
28546
28586
  } else {
28547
28587
  knownProps.set(name, prop);
28548
28588
  deduped.push(prop);
@@ -29396,13 +29436,16 @@ function transformTemplateSlot(node, dir, context) {
29396
29436
  };
29397
29437
  ifNode.negative = negative;
29398
29438
  } else context.options.onError(createCompilerError(30, vElse.loc));
29399
- } else if (vFor) if (vFor.forParseResult) registerDynamicSlot(slots, {
29400
- slotType: 2,
29401
- name: arg,
29402
- fn: block,
29403
- loop: vFor.forParseResult
29404
- });
29405
- else context.options.onError(createCompilerError(32, vFor.loc));
29439
+ } else if (vFor) if (vFor.forParseResult) {
29440
+ const keyProp = findProp(node, "key");
29441
+ registerDynamicSlot(slots, {
29442
+ slotType: 2,
29443
+ name: arg,
29444
+ fn: block,
29445
+ loop: vFor.forParseResult,
29446
+ keyProp: keyProp && propToExpression(keyProp)
29447
+ });
29448
+ } else context.options.onError(createCompilerError(32, vFor.loc));
29406
29449
  return onExit;
29407
29450
  }
29408
29451
  function ensureStaticSlots(slots) {
@@ -43202,7 +43245,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
43202
43245
  //#endregion
43203
43246
  //#region packages/compiler-sfc/src/index.ts
43204
43247
  init_objectSpread2();
43205
- const version = "3.6.0-rc.3";
43248
+ const version = "3.6.0-rc.4";
43206
43249
  const parseCache = parseCache$1;
43207
43250
  const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
43208
43251
  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",
3
+ "version": "3.6.0-rc.4",
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.3",
51
- "@vue/compiler-ssr": "3.6.0-rc.3",
52
- "@vue/compiler-dom": "3.6.0-rc.3",
53
- "@vue/compiler-vapor": "3.6.0-rc.3",
54
- "@vue/shared": "3.6.0-rc.3"
50
+ "@vue/compiler-dom": "3.6.0-rc.4",
51
+ "@vue/compiler-core": "3.6.0-rc.4",
52
+ "@vue/compiler-ssr": "3.6.0-rc.4",
53
+ "@vue/compiler-vapor": "3.6.0-rc.4",
54
+ "@vue/shared": "3.6.0-rc.4"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@babel/types": "^7.29.8",