@wevu/compiler 6.16.11 → 6.16.12

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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -2
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -6569,15 +6569,23 @@ function transformSlotElement(node, context, transformNode) {
6569
6569
  }
6570
6570
  function transformSlotElementPlain(node, context, transformNode) {
6571
6571
  const slotNameInfo = resolveSlotNameFromSlotElement(node);
6572
- if (node.props.some((prop) => {
6572
+ const hasScopeBindings = node.props.some((prop) => {
6573
6573
  if (prop.type === NodeTypes.DIRECTIVE && prop.name === "bind") return prop.arg?.type !== NodeTypes.SIMPLE_EXPRESSION || prop.arg.content !== "name";
6574
6574
  return false;
6575
- })) context.warnings.push("已禁用作用域插槽参数,插槽绑定将被忽略。");
6575
+ });
6576
+ if (hasScopeBindings) context.warnings.push("已禁用作用域插槽参数,插槽绑定将被忽略。");
6576
6577
  const fallbackContent = node.children.map((child) => transformNode(child, context)).join("");
6577
6578
  const slotAttrs = [];
6578
6579
  const nameAttr = renderSlotNameAttribute(slotNameInfo, context, "name");
6579
6580
  if (nameAttr) slotAttrs.push(nameAttr);
6580
6581
  const slotAttrString = slotAttrs.length ? ` ${slotAttrs.join(" ")}` : "";
6582
+ if (!hasScopeBindings && fallbackContent) {
6583
+ const slotPresentExp = createSlotPresenceExpression(slotNameInfo);
6584
+ if (slotPresentExp) {
6585
+ const slotTag = `<slot${slotAttrString} />`;
6586
+ return `${context.platform.wrapIf(slotPresentExp, slotTag, (exp) => renderMustache(exp, context))}${context.platform.wrapElse(fallbackContent)}`;
6587
+ }
6588
+ }
6581
6589
  return fallbackContent ? `<slot${slotAttrString}>${fallbackContent}</slot>` : `<slot${slotAttrString} />`;
6582
6590
  }
6583
6591
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "6.16.11",
4
+ "version": "6.16.12",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "vue": "^3.5.34",
53
53
  "@weapp-core/constants": "^0.1.6",
54
54
  "@weapp-core/shared": "3.0.4",
55
- "@weapp-vite/ast": "6.16.11",
55
+ "@weapp-vite/ast": "6.16.12",
56
56
  "rolldown-require": "2.0.15"
57
57
  },
58
58
  "publishConfig": {