@wevu/compiler 6.16.26 → 6.16.27

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 +22 -6
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -7120,7 +7120,7 @@ function transformSlotElement(node, context, transformNode) {
7120
7120
  ];
7121
7121
  if (context.slotMultipleInstance) scopedAttrs.push(`${WEVU_SLOT_SCOPE_ATTR}="${renderMustache(WEVU_SLOT_SCOPE_KEY, context)}"`);
7122
7122
  const scopedTag = `<${genericKey}${scopedAttrs.length ? ` ${scopedAttrs.join(" ")}` : ""} />`;
7123
- const projectedContent = hasScopeBindings ? scopedTag : `${scopedTag}${context.platform.wrapElse(slotTag)}`;
7123
+ const projectedContent = hasScopeBindings ? `${slotTag}${scopedTag}` : `${scopedTag}${context.platform.wrapElse(slotTag)}`;
7124
7124
  if (fallbackContent && slotPresentExp) return `${context.platform.wrapIf(slotPresentExp, projectedContent, (exp) => renderMustache(exp, context))}${context.platform.wrapElse(fallbackContent)}`;
7125
7125
  return projectedContent;
7126
7126
  }
@@ -8735,7 +8735,15 @@ function resolveScriptSetupPropsDerivedKeys(bindings) {
8735
8735
  function collectScriptSetupReturnInfo(scriptCode) {
8736
8736
  const keys = /* @__PURE__ */ new Set();
8737
8737
  const propsObjectAliases = new Set(["__props"]);
8738
+ const propsRefsAliases = /* @__PURE__ */ new Set();
8738
8739
  const destructuredPropsKeys = /* @__PURE__ */ new Set();
8740
+ const addObjectPatternKeys = (pattern) => {
8741
+ for (const property of pattern.properties) {
8742
+ if (!t.isObjectProperty(property)) continue;
8743
+ if (t.isIdentifier(property.value)) destructuredPropsKeys.add(property.value.name);
8744
+ else if (t.isAssignmentPattern(property.value) && t.isIdentifier(property.value.left)) destructuredPropsKeys.add(property.value.left.name);
8745
+ }
8746
+ };
8739
8747
  try {
8740
8748
  traverse(parseJsLike(scriptCode), {
8741
8749
  VariableDeclarator(path) {
@@ -8744,12 +8752,20 @@ function collectScriptSetupReturnInfo(scriptCode) {
8744
8752
  propsObjectAliases.add(path.node.id.name);
8745
8753
  return;
8746
8754
  }
8747
- if (!t.isObjectPattern(path.node.id) || !t.isIdentifier(init) || !propsObjectAliases.has(init.name)) return;
8748
- for (const property of path.node.id.properties) {
8749
- if (!t.isObjectProperty(property)) continue;
8750
- if (t.isIdentifier(property.value)) destructuredPropsKeys.add(property.value.name);
8751
- else if (t.isAssignmentPattern(property.value) && t.isIdentifier(property.value.left)) destructuredPropsKeys.add(property.value.left.name);
8755
+ if (t.isIdentifier(path.node.id) && t.isCallExpression(init) && t.isIdentifier(init.callee, { name: "toRefs" }) && init.arguments.length === 1 && t.isIdentifier(init.arguments[0]) && propsObjectAliases.has(init.arguments[0].name)) {
8756
+ propsRefsAliases.add(path.node.id.name);
8757
+ return;
8758
+ }
8759
+ if (!t.isObjectPattern(path.node.id)) return;
8760
+ if (t.isIdentifier(init) && propsObjectAliases.has(init.name)) {
8761
+ addObjectPatternKeys(path.node.id);
8762
+ return;
8763
+ }
8764
+ if (t.isIdentifier(init) && propsRefsAliases.has(init.name)) {
8765
+ addObjectPatternKeys(path.node.id);
8766
+ return;
8752
8767
  }
8768
+ if (t.isCallExpression(init) && t.isIdentifier(init.callee, { name: "toRefs" }) && init.arguments.length === 1 && t.isIdentifier(init.arguments[0]) && propsObjectAliases.has(init.arguments[0].name)) addObjectPatternKeys(path.node.id);
8753
8769
  },
8754
8770
  ObjectProperty(path) {
8755
8771
  const objectPath = path.parentPath;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "6.16.26",
4
+ "version": "6.16.27",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -42,18 +42,18 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@jridgewell/remapping": "^2.3.5",
45
- "@vue/compiler-core": "^3.5.34",
46
- "@vue/compiler-dom": "^3.5.34",
45
+ "@vue/compiler-core": "^3.5.35",
46
+ "@vue/compiler-dom": "^3.5.35",
47
47
  "comment-json": "^5.0.0",
48
48
  "lru-cache": "^11.5.0",
49
49
  "magic-string": "^0.30.21",
50
50
  "merge": "^2.1.1",
51
51
  "pathe": "^2.0.3",
52
- "vue": "^3.5.34",
52
+ "vue": "^3.5.35",
53
53
  "@weapp-core/constants": "0.1.10",
54
54
  "@weapp-core/shared": "3.0.4",
55
- "@weapp-vite/ast": "6.16.26",
56
- "rolldown-require": "2.0.17"
55
+ "@weapp-vite/ast": "6.16.27",
56
+ "rolldown-require": "2.0.18"
57
57
  },
58
58
  "publishConfig": {
59
59
  "access": "public",