@wevu/compiler 6.16.8 → 6.16.10

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/index.d.mts CHANGED
@@ -217,8 +217,6 @@ interface ScopedSlotComponentAsset {
217
217
  classStyleBindings?: ClassStyleBinding[];
218
218
  classStyleWxs?: boolean;
219
219
  inlineExpressions?: InlineExpressionAsset[];
220
- ownerKeys?: string[];
221
- ownerPropsExpression?: string;
222
220
  }
223
221
  /**
224
222
  * 内联表达式资源描述。
package/dist/index.mjs CHANGED
@@ -13,7 +13,7 @@ import os from "node:os";
13
13
  import process from "node:process";
14
14
  import { collectFeatureFlagsFromCode, collectJsxImportedComponentsAndDefaultExportFromBabelAst, collectJsxTemplateTagsFromBabelExpression, getRenderPropertyFromComponentOptions, parseJsLikeWithEngine, resolveRenderExpressionFromComponentOptions, toStaticObjectKey, unwrapTypeScriptExpression } from "@weapp-vite/ast";
15
15
  import { LRUCache } from "lru-cache";
16
- import { WEVU_CLASS_STYLE_RUNTIME_FILE, WEVU_CLASS_STYLE_RUNTIME_MODULE, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_GENERIC_SLOT_OWNER_DATA_KEY, WEVU_GENERIC_SLOT_OWNER_ID_ATTR, WEVU_GENERIC_SLOT_OWNER_PROPS_ATTR, WEVU_GENERIC_SLOT_PROPS_ATTR, WEVU_GENERIC_SLOT_PROPS_DATA_ATTR, WEVU_GENERIC_SLOT_PROPS_DATA_KEY, WEVU_GENERIC_SLOT_SCOPE_ATTR, WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_IS_PAGE_KEY, WEVU_LAYOUT_HOSTS_KEY, WEVU_LAYOUT_HOST_ID_PREFIX, WEVU_LAYOUT_HOST_REF_PREFIX, WEVU_MODEL_HANDLER, WEVU_OWNER_HANDLER, WEVU_PROPS_KEY, WEVU_SLOT_NAMES_ATTR, WEVU_SLOT_NAMES_PROP, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_KEY, WEVU_SLOT_OWNER_PROXY_KEY, WEVU_SLOT_PROPS_DATA_KEY, WEVU_SLOT_PROPS_KEY, WEVU_SLOT_SCOPE_KEY, WEVU_TEMPLATE_REFS_KEY } from "@weapp-core/constants";
16
+ import { WEVU_CLASS_STYLE_RUNTIME_FILE, WEVU_CLASS_STYLE_RUNTIME_MODULE, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_INLINE_HANDLER, WEVU_INLINE_MAP_KEY, WEVU_IS_PAGE_KEY, WEVU_LAYOUT_HOSTS_KEY, WEVU_LAYOUT_HOST_ID_PREFIX, WEVU_LAYOUT_HOST_REF_PREFIX, WEVU_MODEL_HANDLER, WEVU_OWNER_HANDLER, WEVU_PROPS_KEY, WEVU_SLOT_NAMES_ATTR, WEVU_SLOT_NAMES_PROP, WEVU_SLOT_OWNER_ATTR, WEVU_SLOT_OWNER_ID_ATTR, WEVU_SLOT_OWNER_ID_KEY, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_OWNER_KEY, WEVU_SLOT_PROPS_ATTR, WEVU_SLOT_PROPS_DATA_KEY, WEVU_SLOT_PROPS_KEY, WEVU_SLOT_SCOPE_ATTR, WEVU_SLOT_SCOPE_KEY, WEVU_TEMPLATE_REFS_KEY } from "@weapp-core/constants";
17
17
  import { compileScript, parse } from "vue/compiler-sfc";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import { parse as parse$1 } from "@vue/compiler-dom";
@@ -3145,11 +3145,11 @@ function normalizeJsxText(value) {
3145
3145
  function printExpression(exp) {
3146
3146
  return generate(exp).code;
3147
3147
  }
3148
- function unwrapTsExpression$3(exp) {
3148
+ function unwrapTsExpression$2(exp) {
3149
3149
  return unwrapTypeScriptExpression(exp);
3150
3150
  }
3151
3151
  function normalizeInterpolationExpression(exp) {
3152
- return normalizeWxmlExpression(printExpression(unwrapTsExpression$3(exp)));
3152
+ return normalizeWxmlExpression(printExpression(unwrapTsExpression$2(exp)));
3153
3153
  }
3154
3154
  function renderMustache$1(expression, context) {
3155
3155
  return context.mustacheInterpolation === "spaced" ? `{{ ${expression} }}` : `{{${expression}}}`;
@@ -3701,7 +3701,7 @@ function readJsxAttributeExpression(value) {
3701
3701
  if (t.isStringLiteral(value)) return value;
3702
3702
  if (!t.isJSXExpressionContainer(value)) return null;
3703
3703
  if (t.isJSXEmptyExpression(value.expression)) return null;
3704
- return unwrapTsExpression$3(value.expression);
3704
+ return unwrapTsExpression$2(value.expression);
3705
3705
  }
3706
3706
  function extractJsxKeyExpression(node) {
3707
3707
  for (const attr of node.openingElement.attributes) {
@@ -3783,10 +3783,10 @@ function compileMapExpression(exp, context) {
3783
3783
  let bodyExp = null;
3784
3784
  if (t.isBlockStatement(callback.body)) {
3785
3785
  for (const statement of callback.body.body) if (t.isReturnStatement(statement) && statement.argument) {
3786
- bodyExp = unwrapTsExpression$3(statement.argument);
3786
+ bodyExp = unwrapTsExpression$2(statement.argument);
3787
3787
  break;
3788
3788
  }
3789
- } else bodyExp = unwrapTsExpression$3(callback.body);
3789
+ } else bodyExp = unwrapTsExpression$2(callback.body);
3790
3790
  const body = bodyExp ? compileRenderableExpression(bodyExp, context) : "";
3791
3791
  popScope$1(context, addedScope.length);
3792
3792
  if (!body) return "";
@@ -3821,7 +3821,7 @@ function compileLogicalExpression(exp, context) {
3821
3821
  return renderMustache$1(normalizeInterpolationExpression(exp), context);
3822
3822
  }
3823
3823
  function compileRenderableExpression(exp, context) {
3824
- const node = unwrapTsExpression$3(exp);
3824
+ const node = unwrapTsExpression$2(exp);
3825
3825
  if (t.isJSXElement(node)) return compileJsxElement(node, context);
3826
3826
  if (t.isJSXFragment(node)) return compileJsxFragment(node, context);
3827
3827
  if (t.isConditionalExpression(node)) return compileConditionalExpression(node, context);
@@ -5112,10 +5112,8 @@ const SCOPED_SLOT_GLOBALS = new Set([
5112
5112
  "require",
5113
5113
  "arguments",
5114
5114
  WEVU_SLOT_OWNER_KEY,
5115
- WEVU_GENERIC_SLOT_OWNER_DATA_KEY,
5116
5115
  WEVU_SLOT_PROPS_KEY,
5117
5116
  WEVU_SLOT_PROPS_DATA_KEY,
5118
- WEVU_GENERIC_SLOT_PROPS_DATA_KEY,
5119
5117
  WEVU_CLASS_STYLE_RUNTIME_MODULE
5120
5118
  ]);
5121
5119
  function collectScopedSlotLocals(context) {
@@ -5146,10 +5144,6 @@ function replaceIdentifierWithExpression(path, replacement) {
5146
5144
  path.replaceWith(replacement);
5147
5145
  }
5148
5146
  const IDENTIFIER_RE$3 = /^[A-Z_$][\w$]*$/i;
5149
- function unwrapTsExpression$2(node) {
5150
- if (t.isTSAsExpression(node) || t.isTSNonNullExpression(node) || t.isTSTypeAssertion(node) || t.isTSSatisfiesExpression(node)) return unwrapTsExpression$2(node.expression);
5151
- return node;
5152
- }
5153
5147
  function rewriteScopedSlotExpression(exp, context) {
5154
5148
  const normalized = normalizeWxmlExpression(exp);
5155
5149
  const parsed = parseBabelExpressionFile(normalized);
@@ -5163,40 +5157,25 @@ function rewriteScopedSlotExpression(exp, context) {
5163
5157
  if (IDENTIFIER_RE$3.test(prop)) return t.memberExpression(t.identifier(target), t.identifier(prop));
5164
5158
  return t.memberExpression(t.identifier(target), t.stringLiteral(prop), true);
5165
5159
  };
5166
- traverse(ast, {
5167
- TSAsExpression(path) {
5168
- path.replaceWith(unwrapTsExpression$2(path.node));
5169
- },
5170
- TSSatisfiesExpression(path) {
5171
- path.replaceWith(unwrapTsExpression$2(path.node));
5172
- },
5173
- TSTypeAssertion(path) {
5174
- path.replaceWith(unwrapTsExpression$2(path.node));
5175
- },
5176
- TSNonNullExpression(path) {
5177
- path.replaceWith(unwrapTsExpression$2(path.node));
5178
- },
5179
- Identifier(path) {
5180
- if (!path.isReferencedIdentifier()) return;
5181
- const name = path.node.name;
5182
- if (SCOPED_SLOT_GLOBALS.has(name)) return;
5183
- if (path.scope.hasBinding(name)) return;
5184
- if (hasOwn(forAliases, name)) {
5185
- const aliasExp = parseBabelExpression(forAliases[name]);
5186
- if (aliasExp) {
5187
- replaceIdentifierWithExpression(path, t.cloneNode(aliasExp, true));
5188
- return;
5189
- }
5190
- }
5191
- if (locals.has(name)) return;
5192
- if (hasOwn(slotProps, name)) {
5193
- const prop = slotProps[name];
5194
- replaceIdentifierWithExpression(path, createMemberAccess(WEVU_GENERIC_SLOT_PROPS_DATA_KEY, prop));
5160
+ traverse(ast, { Identifier(path) {
5161
+ if (!path.isReferencedIdentifier()) return;
5162
+ const name = path.node.name;
5163
+ if (SCOPED_SLOT_GLOBALS.has(name)) return;
5164
+ if (path.scope.hasBinding(name)) return;
5165
+ if (hasOwn(forAliases, name)) {
5166
+ const aliasExp = parseBabelExpression(forAliases[name]);
5167
+ if (aliasExp) {
5168
+ replaceIdentifierWithExpression(path, t.cloneNode(aliasExp, true));
5195
5169
  return;
5196
5170
  }
5197
- replaceIdentifierWithExpression(path, createMemberAccess(WEVU_GENERIC_SLOT_PROPS_DATA_KEY, name));
5198
5171
  }
5199
- });
5172
+ if (locals.has(name)) return;
5173
+ if (hasOwn(slotProps, name)) {
5174
+ replaceIdentifierWithExpression(path, createMemberAccess(WEVU_SLOT_PROPS_DATA_KEY, slotProps[name]));
5175
+ return;
5176
+ }
5177
+ replaceIdentifierWithExpression(path, createMemberAccess(WEVU_SLOT_OWNER_KEY, name));
5178
+ } });
5200
5179
  const stmt = ast.program.body[0];
5201
5180
  const updatedExpression = stmt && "expression" in stmt ? stmt.expression : null;
5202
5181
  return updatedExpression ? generateExpression(updatedExpression) : normalized;
@@ -5557,22 +5536,9 @@ function createMemberAccess(target, prop) {
5557
5536
  function createThisMemberAccess(prop) {
5558
5537
  return createMemberAccess(t.thisExpression(), prop);
5559
5538
  }
5560
- function createScopedSlotOwnerRuntimeAccess() {
5561
- return t.logicalExpression("||", createThisMemberAccess(WEVU_SLOT_OWNER_PROXY_KEY), createThisMemberAccess(WEVU_SLOT_OWNER_KEY));
5562
- }
5563
5539
  function createUnrefCall(exp) {
5564
5540
  return t.callExpression(t.identifier("__wevuUnref"), [exp]);
5565
5541
  }
5566
- function isCallCalleeIdentifier(path) {
5567
- const parent = path.parentPath;
5568
- if (parent.isCallExpression() && parent.node.callee === path.node) return true;
5569
- if (parent.isOptionalCallExpression() && parent.node.callee === path.node) return true;
5570
- if (!parent.isMemberExpression()) return false;
5571
- const grandParent = parent.parentPath;
5572
- if (grandParent.isCallExpression() && grandParent.node.callee === parent.node) return true;
5573
- if (grandParent.isOptionalCallExpression() && grandParent.node.callee === parent.node) return true;
5574
- return false;
5575
- }
5576
5542
  function createHasOwnPropertyCall(target, key) {
5577
5543
  return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Object"), t.identifier("prototype")), t.identifier("hasOwnProperty")), t.identifier("call")), [target, t.stringLiteral(key)]);
5578
5544
  }
@@ -5643,10 +5609,7 @@ function normalizeJsExpressionWithContext(exp, context, options) {
5643
5609
  const base = createThisMemberAccess(WEVU_SLOT_PROPS_DATA_KEY);
5644
5610
  replacement = createUnrefCall(prop ? createMemberAccess(base, prop) : base);
5645
5611
  } else if (name === WEVU_SLOT_OWNER_KEY || name === WEVU_SLOT_PROPS_DATA_KEY || name === WEVU_SLOT_PROPS_KEY || name === WEVU_SLOT_SCOPE_KEY) replacement = createUnrefCall(createThisMemberAccess(name));
5646
- else {
5647
- const ownerAccess = createMemberAccess(createScopedSlotOwnerRuntimeAccess(), name);
5648
- replacement = isCallCalleeIdentifier(path) ? ownerAccess : createUnrefCall(ownerAccess);
5649
- }
5612
+ else replacement = createUnrefCall(createMemberAccess(createThisMemberAccess(WEVU_SLOT_OWNER_KEY), name));
5650
5613
  else replacement = createUnrefCall(createIdentifierAccessWithPropsFallback(name));
5651
5614
  const parent = path.parentPath;
5652
5615
  if (parent.isObjectProperty() && parent.node.shorthand && parent.node.key === path.node) {
@@ -5690,26 +5653,17 @@ function shouldFallbackToRuntimeBinding(exp) {
5690
5653
  * 将复杂表达式注册为 JS 运行时计算绑定,返回可用于模板 mustache 的绑定引用。
5691
5654
  */
5692
5655
  function registerRuntimeBindingExpression(exp, context, options) {
5693
- const forIndexAccess = buildForIndexAccess$1(context);
5694
- const bindingContext = context.rewriteScopedSlot && context.scopedSlotOwnerRuntimeBindingTarget ? context.scopedSlotOwnerRuntimeBindingTarget : context;
5695
- const cacheKey = context.rewriteScopedSlot && !forIndexAccess ? `${options?.prefix ?? ""}:${exp.trim()}` : void 0;
5696
- if (cacheKey) {
5697
- const cached = context.runtimeBindingCache?.get(cacheKey);
5698
- if (cached) return cached;
5699
- }
5700
- const expAst = normalizeJsExpressionWithContext(exp, bindingContext, options);
5656
+ const expAst = normalizeJsExpressionWithContext(exp, context, options);
5701
5657
  if (!expAst) return null;
5702
5658
  const binding = {
5703
- name: `${options?.prefix ?? context.runtimeBindingPrefix ?? "__wv_bind_"}${bindingContext.classStyleBindings.filter((item) => item.type === "bind").length}`,
5659
+ name: `__wv_bind_${context.classStyleBindings.filter((item) => item.type === "bind").length}`,
5704
5660
  type: "bind",
5705
5661
  exp,
5706
5662
  expAst,
5707
- forStack: bindingContext.forStack.map((info) => ({ ...info }))
5663
+ forStack: context.forStack.map((info) => ({ ...info }))
5708
5664
  };
5709
- bindingContext.classStyleBindings.push(binding);
5710
- const bindingRef = context.rewriteScopedSlot ? `${WEVU_GENERIC_SLOT_PROPS_DATA_KEY}.${binding.name}${forIndexAccess}` : `${binding.name}${forIndexAccess}`;
5711
- if (cacheKey) context.runtimeBindingCache?.set(cacheKey, bindingRef);
5712
- return bindingRef;
5665
+ context.classStyleBindings.push(binding);
5666
+ return `${binding.name}${buildForIndexAccess$1(context)}`;
5713
5667
  }
5714
5668
  //#endregion
5715
5669
  //#region src/plugins/vue/compiler/template/mustache.ts
@@ -6254,17 +6208,6 @@ function collectElementAttributes(node, context, options) {
6254
6208
  }
6255
6209
  if (prop.name === "text" && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION) {
6256
6210
  const rawExp = prop.exp.content;
6257
- if (context.nativeSlotScopeRuntime) {
6258
- const runtimeExp = registerRuntimeBindingExpression(rawExp, context.nativeSlotScopeRuntime.owner, {
6259
- hint: "v-text",
6260
- prefix: context.nativeSlotScopeRuntime.runtimeBindingPrefix
6261
- });
6262
- if (runtimeExp) {
6263
- context.nativeSlotScopeRuntime.bindings.set(runtimeExp, runtimeExp);
6264
- vTextExp = runtimeExp;
6265
- continue;
6266
- }
6267
- }
6268
6211
  vTextExp = (shouldFallbackToRuntimeBinding(rawExp) ? registerRuntimeBindingExpression(rawExp, context, { hint: "v-text" }) : null) ?? normalizeWxmlExpressionWithContext(rawExp, context);
6269
6212
  continue;
6270
6213
  }
@@ -6364,10 +6307,7 @@ function parseSlotPropsExpression(exp, context) {
6364
6307
  }
6365
6308
  return {};
6366
6309
  }
6367
- function renderObjectBindingKey(key) {
6368
- return /^[A-Z_$][\w$]*$/i.test(key) ? key : toWxmlStringLiteral$1(key);
6369
- }
6370
- function collectSlotBindingExpressions(node, context) {
6310
+ function collectSlotBindingExpression(node, context) {
6371
6311
  let bindObjectExp = null;
6372
6312
  const namedBindings = [];
6373
6313
  for (const prop of node.props) {
@@ -6399,18 +6339,9 @@ function collectSlotBindingExpressions(node, context) {
6399
6339
  context.warnings.push("作用域插槽参数使用 v-bind 对象时,将忽略额外的命名绑定。");
6400
6340
  namedBindings.length = 0;
6401
6341
  }
6402
- if (bindObjectExp) return {
6403
- data: bindObjectExp,
6404
- props: bindObjectExp
6405
- };
6406
- if (!namedBindings.length) return {
6407
- data: null,
6408
- props: null
6409
- };
6410
- return {
6411
- data: `{${namedBindings.map((entry) => `${renderObjectBindingKey(entry.key)}:${entry.value}`).join(",")}}`,
6412
- props: `[${namedBindings.map((entry) => `${toWxmlStringLiteral$1(entry.key)},${entry.value}`).join(",")}]`
6413
- };
6342
+ if (bindObjectExp) return bindObjectExp;
6343
+ if (!namedBindings.length) return null;
6344
+ return `[${namedBindings.map((entry) => `${toWxmlStringLiteral$1(entry.key)},${entry.value}`).join(",")}]`;
6414
6345
  }
6415
6346
  //#endregion
6416
6347
  //#region src/plugins/vue/compiler/template/elements/tag-slot.ts
@@ -6468,12 +6399,6 @@ function resolveSlotStaticName(info) {
6468
6399
  if (info.type === "static") return info.value || "default";
6469
6400
  }
6470
6401
  const SLOT_PRESENCE_IDENTIFIER_RE = /^[A-Z_$][\w$]*$/i;
6471
- const SLOT_OWNER_KEY_RE = /\bwvslotowner(?:\.([A-Z_$][\w$]*)|\[['"]([^'"]+)['"]\])/gi;
6472
- const SLOT_OWNER_PROP_PREFIX_RE = /\bwvslotownerprop([A-Z_$][\w$]*)\b/gi;
6473
- const SLOT_PROPS_DATA_KEY_RE = /\bwvslotpropsdata(?:\.([A-Z_$][\w$]*)|\[['"]([^'"]+)['"]\])/gi;
6474
- function renderOwnerPropSourceExpression(key) {
6475
- return SLOT_PRESENCE_IDENTIFIER_RE.test(key) ? key : `${WEVU_SLOT_OWNER_ID_KEY}['${key.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}']`;
6476
- }
6477
6402
  function createSlotPresenceExpression(info) {
6478
6403
  const slotName = resolveSlotStaticName(info);
6479
6404
  if (!slotName) return;
@@ -6488,66 +6413,6 @@ function buildSlotDeclaration(name, propsExp, children, context, options) {
6488
6413
  condition: options?.condition
6489
6414
  };
6490
6415
  }
6491
- function collectOwnerMemberKey(node, ownerKeys, slotPropKeys) {
6492
- const object = node.object;
6493
- if (object.type !== "Identifier" || object.name !== "wvslotowner" && object.name !== "wvslotpropsdata") return;
6494
- const property = node.property;
6495
- if (!node.computed && property.type === "Identifier") {
6496
- if (object.name === "wvslotpropsdata" && slotPropKeys.has(property.name)) return;
6497
- ownerKeys.add(property.name);
6498
- } else if (node.computed && property.type === "StringLiteral") {
6499
- if (object.name === "wvslotpropsdata" && slotPropKeys.has(property.value)) return;
6500
- ownerKeys.add(property.value);
6501
- }
6502
- }
6503
- function collectScopedSlotOwnerKeys(template, slotPropKeys) {
6504
- const ownerKeys = /* @__PURE__ */ new Set();
6505
- let match = SLOT_OWNER_KEY_RE.exec(template);
6506
- while (match) {
6507
- const key = match[1] ?? match[2];
6508
- if (key) ownerKeys.add(key);
6509
- match = SLOT_OWNER_KEY_RE.exec(template);
6510
- }
6511
- SLOT_OWNER_KEY_RE.lastIndex = 0;
6512
- match = SLOT_OWNER_PROP_PREFIX_RE.exec(template);
6513
- while (match) {
6514
- const key = match[1];
6515
- if (key) ownerKeys.add(key);
6516
- match = SLOT_OWNER_PROP_PREFIX_RE.exec(template);
6517
- }
6518
- SLOT_OWNER_PROP_PREFIX_RE.lastIndex = 0;
6519
- const computedExpressions = template.match(/\{\{([\s\S]*?)\}\}/g) ?? [];
6520
- for (const raw of computedExpressions) {
6521
- const parsed = parseBabelExpressionFile(raw.slice(2, -2).trim());
6522
- if (!parsed) continue;
6523
- traverse(parsed.ast, {
6524
- MemberExpression(path) {
6525
- collectOwnerMemberKey(path.node, ownerKeys, slotPropKeys);
6526
- },
6527
- OptionalMemberExpression(path) {
6528
- collectOwnerMemberKey(path.node, ownerKeys, slotPropKeys);
6529
- }
6530
- });
6531
- }
6532
- return ownerKeys.size ? [...ownerKeys].sort((a, b) => a.localeCompare(b)) : void 0;
6533
- }
6534
- function collectScopedSlotPropsDataKeys(template) {
6535
- const keys = /* @__PURE__ */ new Set();
6536
- let match = SLOT_PROPS_DATA_KEY_RE.exec(template);
6537
- while (match) {
6538
- const key = match[1] ?? match[2];
6539
- if (key) keys.add(key);
6540
- match = SLOT_PROPS_DATA_KEY_RE.exec(template);
6541
- }
6542
- SLOT_PROPS_DATA_KEY_RE.lastIndex = 0;
6543
- return [...keys].sort((a, b) => a.localeCompare(b));
6544
- }
6545
- function renderScopedSlotPropsDataReadyGuard(keys) {
6546
- if (!keys.length) return;
6547
- return keys.map((key) => {
6548
- return `${SLOT_PRESENCE_IDENTIFIER_RE.test(key) ? `${WEVU_GENERIC_SLOT_PROPS_DATA_KEY}.${key}` : `${WEVU_GENERIC_SLOT_PROPS_DATA_KEY}[${toWxmlStringLiteral$1(key)}]`}!==undefined`;
6549
- }).join("&&");
6550
- }
6551
6416
  function createScopedSlotComponent(context, slotKey, props, children, transformNode) {
6552
6417
  const ownerHash = hashString(context.filename);
6553
6418
  const index = context.scopedSlotComponents.length;
@@ -6568,36 +6433,27 @@ function createScopedSlotComponent(context, slotKey, props, children, transformN
6568
6433
  slotPropStack: [],
6569
6434
  rewriteScopedSlot: true,
6570
6435
  classStyleBindings: [],
6571
- runtimeBindingCache: /* @__PURE__ */ new Map(),
6572
- runtimeBindingPrefix: "wvslotbind",
6573
6436
  classStyleWxs: false,
6574
6437
  forStack: [],
6575
6438
  forIndexSeed: 0,
6576
6439
  inlineExpressions: [],
6577
- inlineExpressionSeed: 0,
6578
- scopedSlotOwnerRuntimeBindingTarget: context
6440
+ inlineExpressionSeed: 0
6579
6441
  };
6580
- const slotMapping = {
6442
+ let template = withSlotProps(scopedContext, {
6581
6443
  ...collectScopePropMapping(context),
6582
6444
  ...props
6583
- };
6584
- let template = withSlotProps(scopedContext, slotMapping, () => {
6445
+ }, () => {
6585
6446
  return children.map((child) => transformNode(child, scopedContext)).join("");
6586
6447
  });
6587
- const slotPropsDataReadyGuard = renderScopedSlotPropsDataReadyGuard(collectScopedSlotPropsDataKeys(template));
6588
- if (slotPropsDataReadyGuard) template = scopedContext.platform.wrapIf(slotPropsDataReadyGuard, template, (exp) => renderMustache(exp, scopedContext));
6589
6448
  if (scopedContext.classStyleWxs) template = `${buildClassStyleWxsTag(scopedContext.classStyleWxsExtension || "wxs", scopedContext.classStyleWxsSrc)}\n${template}`;
6590
6449
  asset.template = template;
6591
6450
  asset.componentGenerics = Object.keys(scopedContext.componentGenerics).length ? scopedContext.componentGenerics : void 0;
6592
6451
  asset.classStyleBindings = scopedContext.classStyleBindings.length ? scopedContext.classStyleBindings : void 0;
6593
6452
  asset.classStyleWxs = scopedContext.classStyleWxs || void 0;
6594
6453
  asset.inlineExpressions = scopedContext.inlineExpressions.length ? scopedContext.inlineExpressions : void 0;
6595
- asset.ownerKeys = collectScopedSlotOwnerKeys(template, new Set(Object.values(slotMapping)));
6596
- if (asset.ownerKeys?.length) asset.ownerPropsExpression = `[${asset.ownerKeys.map((key) => `'${key}',${renderOwnerPropSourceExpression(key)}`).join(",")}]`;
6597
6454
  return {
6598
6455
  componentName,
6599
- slotKey,
6600
- asset
6456
+ slotKey
6601
6457
  };
6602
6458
  }
6603
6459
  function injectAttributeIntoOpeningTag(source, attr) {
@@ -6626,25 +6482,15 @@ function createSlotAttributeNode(sourceNode, attr) {
6626
6482
  loc: sourceNode.loc
6627
6483
  };
6628
6484
  }
6629
- function injectSlotAttributeIntoStructuralElementNode(child, slotAttr, transformNode, context) {
6485
+ function injectSlotAttributeIntoElementNode(child, slotAttr, transformNode, context) {
6630
6486
  if (child.type !== NodeTypes.ELEMENT || child.tag === "template") return null;
6631
6487
  const sourceNode = child;
6632
- const structural = isStructuralDirective(sourceNode);
6633
- if (structural.type !== "if" || structural.directive?.name !== "if" || !structural.directive.exp) return null;
6634
6488
  const slotAttribute = createSlotAttributeNode(sourceNode, slotAttr);
6635
6489
  if (!slotAttribute) return null;
6636
- const elementWithoutIf = {
6490
+ return transformNode({
6637
6491
  ...sourceNode,
6638
- props: [slotAttribute, ...sourceNode.props.filter((prop) => prop !== structural.directive)]
6639
- };
6640
- const expValue = normalizeWxmlExpressionWithContext(structural.directive.exp.type === NodeTypes.SIMPLE_EXPRESSION ? structural.directive.exp.content : "", context);
6641
- const tag = sourceNode.tag;
6642
- const { attrs, vTextExp } = collectElementAttributes(elementWithoutIf, context, { skipSlotDirective: true });
6643
- let children = "";
6644
- if (sourceNode.children.length > 0) children = sourceNode.children.map((childNode) => transformNode(childNode, context)).join("");
6645
- if (vTextExp !== void 0) children = renderMustache(vTextExp, context);
6646
- const attrString = attrs.length ? ` ${attrs.join(" ")}` : "";
6647
- return (children ? `<${tag}${attrString}>${children}</${tag}>` : `<${tag}${attrString} />`).replace(/^<([^\s>/]+)/, `<$1 ${context.platform.directives.ifAttr}="${renderMustache(expValue, context)}"`);
6492
+ props: [slotAttribute, ...sourceNode.props]
6493
+ }, context);
6648
6494
  }
6649
6495
  function isRenderableFallbackChild(child) {
6650
6496
  if (child.type === NodeTypes.COMMENT) return false;
@@ -6670,11 +6516,7 @@ function renderSlotFallback(decl, context, transformNode) {
6670
6516
  }
6671
6517
  if (renderableChildren.length === 1) {
6672
6518
  const child = renderableChildren[0];
6673
- if (child.type === NodeTypes.ELEMENT && isStructuralDirective(child).type) {
6674
- const projected = injectSlotAttributeIntoStructuralElementNode(child, slotAttr, transformNode, context);
6675
- if (projected) return wrapCondition(projected);
6676
- }
6677
- const projected = injectAttributeIntoOpeningTag(transformNode(child, context), slotAttr);
6519
+ const projected = child.type === NodeTypes.ELEMENT && isStructuralDirective(child).type ? injectSlotAttributeIntoElementNode(child, slotAttr, transformNode, context) : injectAttributeIntoOpeningTag(transformNode(child, context), slotAttr);
6678
6520
  if (projected) return wrapCondition(projected);
6679
6521
  }
6680
6522
  return wrapCondition(`<view ${slotAttr}>${renderableChildren.map((child) => transformNode(child, context)).join("")}</view>`);
@@ -6682,8 +6524,7 @@ function renderSlotFallback(decl, context, transformNode) {
6682
6524
  function transformSlotElement(node, context, transformNode) {
6683
6525
  if (isScopedSlotsDisabled(context)) return transformSlotElementPlain(node, context, transformNode);
6684
6526
  const slotNameInfo = resolveSlotNameFromSlotElement(node);
6685
- const slotBindingExps = collectSlotBindingExpressions(node, context);
6686
- const slotPropsExp = slotBindingExps.props;
6527
+ let slotPropsExp = collectSlotBindingExpression(node, context);
6687
6528
  let fallbackContent = "";
6688
6529
  if (node.children.length > 0) fallbackContent = node.children.map((child) => transformNode(child, context)).join("");
6689
6530
  const slotAttrs = [];
@@ -6692,28 +6533,22 @@ function transformSlotElement(node, context, transformNode) {
6692
6533
  const slotAttrString = slotAttrs.length ? ` ${slotAttrs.join(" ")}` : "";
6693
6534
  let slotTag = `<slot${slotAttrString} />`;
6694
6535
  const slotPresentExp = fallbackContent ? createSlotPresenceExpression(slotNameInfo) : void 0;
6695
- if (fallbackContent && !slotPropsExp && !slotPresentExp) slotTag = `<slot${slotAttrString}>${fallbackContent}</slot>`;
6696
- if (!slotPropsExp && context.scopedSlotsRequireProps) {
6697
- if (fallbackContent && slotPresentExp) return `${context.platform.wrapIf(slotPresentExp, slotTag, (exp) => renderMustache(exp, context))}${context.platform.wrapElse(fallbackContent)}`;
6698
- return slotTag;
6536
+ if (fallbackContent) {
6537
+ if (!slotPropsExp && slotPresentExp) slotTag = `${context.platform.wrapIf(slotPresentExp, slotTag, (exp) => renderMustache(exp, context))}${context.platform.wrapElse(fallbackContent)}`;
6538
+ else if (!slotPropsExp) slotTag = `<slot${slotAttrString}>${fallbackContent}</slot>`;
6699
6539
  }
6540
+ if (!slotPropsExp && (context.scopedSlotsRequireProps || slotNameInfo.type !== "default")) return slotTag;
6700
6541
  const genericKey = `scoped-slots-${resolveSlotKey(context, slotNameInfo)}`;
6701
6542
  context.componentGenerics[genericKey] = true;
6702
- const slotPropsFallbackExp = slotPropsExp ?? WEVU_GENERIC_SLOT_OWNER_PROPS_ATTR;
6703
- const slotPropsDataExp = slotPropsExp && slotBindingExps.data ? registerRuntimeBindingExpression(slotBindingExps.data, context, {
6704
- hint: "scoped slot props data",
6705
- prefix: `${WEVU_GENERIC_SLOT_PROPS_DATA_ATTR}_`
6706
- }) ?? slotPropsFallbackExp : WEVU_GENERIC_SLOT_PROPS_DATA_KEY;
6543
+ slotPropsExp = slotPropsExp ?? "[]";
6707
6544
  const scopedAttrs = [
6708
- `${WEVU_GENERIC_SLOT_OWNER_ID_ATTR}="${renderMustache(WEVU_GENERIC_SLOT_OWNER_ID_ATTR, context)}"`,
6709
- `${WEVU_GENERIC_SLOT_PROPS_ATTR}="${renderMustache(slotPropsFallbackExp, context)}"`,
6710
- `${WEVU_GENERIC_SLOT_PROPS_DATA_ATTR}="${renderMustache(slotPropsDataExp, context)}"`
6545
+ `${context.platform.directives.ifAttr}="${renderMustache(WEVU_SLOT_OWNER_ID_PROP, context)}"`,
6546
+ `${WEVU_SLOT_OWNER_ATTR}="${renderMustache(WEVU_SLOT_OWNER_ID_PROP, context)}"`,
6547
+ `${WEVU_SLOT_PROPS_ATTR}="${renderMustache(slotPropsExp, context)}"`
6711
6548
  ];
6712
- if (context.slotMultipleInstance) scopedAttrs.push(`${WEVU_GENERIC_SLOT_SCOPE_ATTR}="${renderMustache(WEVU_SLOT_SCOPE_KEY, context)}"`);
6713
- scopedAttrs.push(`${WEVU_GENERIC_SLOT_OWNER_PROPS_ATTR}="${renderMustache(WEVU_GENERIC_SLOT_OWNER_PROPS_ATTR, context)}"`);
6714
- const scopedAttrString = scopedAttrs.length ? ` ${scopedAttrs.join(" ")}` : "";
6715
- const scopedTag = context.platform.wrapIf(WEVU_GENERIC_SLOT_OWNER_ID_ATTR, `<${genericKey}${scopedAttrString} />`, (exp) => renderMustache(exp, context));
6716
- const projectedContent = slotPropsExp ? scopedTag : `${slotTag}${scopedTag}`;
6549
+ if (context.slotMultipleInstance) scopedAttrs.push(`${WEVU_SLOT_SCOPE_ATTR}="${renderMustache(WEVU_SLOT_SCOPE_KEY, context)}"`);
6550
+ const scopedTag = `<${genericKey}${scopedAttrs.length ? ` ${scopedAttrs.join(" ")}` : ""} />`;
6551
+ const projectedContent = `${slotTag}${scopedTag}`;
6717
6552
  if (fallbackContent && slotPresentExp) return `${context.platform.wrapIf(slotPresentExp, projectedContent, (exp) => renderMustache(exp, context))}${context.platform.wrapElse(fallbackContent)}`;
6718
6553
  return projectedContent;
6719
6554
  }
@@ -6732,18 +6567,6 @@ function transformSlotElementPlain(node, context, transformNode) {
6732
6567
  }
6733
6568
  //#endregion
6734
6569
  //#region src/plugins/vue/compiler/template/elements/tag-component.ts
6735
- function createNativeSlotContext(context) {
6736
- return {
6737
- ...context,
6738
- classStyleBindings: context.classStyleBindings,
6739
- runtimeBindingCache: context.runtimeBindingCache,
6740
- nativeSlotScopeRuntime: {
6741
- owner: context,
6742
- bindings: /* @__PURE__ */ new Map(),
6743
- runtimeBindingPrefix: "wvslotbind"
6744
- }
6745
- };
6746
- }
6747
6570
  function hasLegacySlotAttribute(children) {
6748
6571
  return children.some((child) => {
6749
6572
  if (child.type !== NodeTypes.ELEMENT) return false;
@@ -6764,52 +6587,14 @@ function hasDirectComponentSlotChild(children, context) {
6764
6587
  return /^[A-Z]/.test(child.tag);
6765
6588
  });
6766
6589
  }
6767
- function hasComponentSlotDescendant(children, context) {
6768
- return children.some((child) => {
6769
- if (child.type !== NodeTypes.ELEMENT) return false;
6770
- if (child.tag === "template") return false;
6771
- if (child.tag === "component") return true;
6772
- return !isBuiltinTag(resolveTemplateTagName(child.tag, context)) || /^[A-Z]/.test(child.tag) || hasComponentSlotDescendant(child.children, context);
6773
- });
6774
- }
6775
- function hasStructuralSlotRoot(children) {
6776
- return children.some((child) => {
6777
- if (child.type !== NodeTypes.ELEMENT) return false;
6778
- return Boolean(isStructuralDirective(child).type);
6779
- });
6780
- }
6781
- function hasParentExpressionSlotContent(children) {
6782
- return children.some((child) => {
6783
- if (child.type === NodeTypes.INTERPOLATION) return true;
6784
- if (child.type !== NodeTypes.ELEMENT) return false;
6785
- const element = child;
6786
- if (element.props.some((prop) => prop.type === NodeTypes.DIRECTIVE && prop.name !== "slot")) return true;
6787
- return hasParentExpressionSlotContent(element.children);
6788
- });
6789
- }
6790
- function hasRuntimeOnlySlotExpression(children) {
6791
- return children.some((child) => {
6792
- if (child.type === NodeTypes.INTERPOLATION) {
6793
- const content = child.content;
6794
- return shouldFallbackToRuntimeBinding(content?.type === NodeTypes.SIMPLE_EXPRESSION ? content.content : "");
6795
- }
6796
- if (child.type !== NodeTypes.ELEMENT) return false;
6797
- const element = child;
6798
- if (element.props.some((prop) => {
6799
- if (prop.type !== NodeTypes.DIRECTIVE || prop.name === "slot") return false;
6800
- return shouldFallbackToRuntimeBinding(prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION ? prop.exp.content : "");
6801
- })) return true;
6802
- return hasRuntimeOnlySlotExpression(element.children);
6803
- });
6590
+ function isWevuComponentTag(node, context) {
6591
+ return context.wevuComponentTags ? context.wevuComponentTags.has(node.tag) : /^[A-Z]/.test(node.tag);
6804
6592
  }
6805
- function shouldAugmentPlainSlot(decl, context) {
6806
- if (context.scopedSlotsRequireProps) return false;
6807
- if (hasParentExpressionSlotContent(decl.children)) return hasComponentSlotDescendant(decl.children, context) || context.scopedSlotsCompiler === "augmented" && (hasStructuralSlotRoot(decl.children) || hasRuntimeOnlySlotExpression(decl.children));
6808
- if (context.scopedSlotsCompiler === "augmented" && !decl.implicitDefault && (!context.slotSingleRootNoWrapper || hasStructuralSlotRoot(decl.children))) return true;
6809
- if (context.scopedSlotsCompiler === "augmented" && decl.implicitDefault && hasComponentSlotDescendant(decl.children, context)) return true;
6810
- if (hasDirectComponentSlotChild(decl.children, context)) return true;
6811
- if (!decl.implicitDefault) return false;
6812
- return context.scopedSlotsCompiler === "augmented" && (hasStructuralSlotRoot(decl.children) || hasRuntimeOnlySlotExpression(decl.children));
6593
+ function shouldAugmentPlainDefaultSlot(decl, context, ownerNode) {
6594
+ if (context.scopedSlotsRequireProps || !decl.implicitDefault) return false;
6595
+ if (context.rewriteScopedSlot && !isWevuComponentTag(ownerNode, context)) return false;
6596
+ if (context.scopedSlotsCompiler === "augmented") return true;
6597
+ return hasDirectComponentSlotChild(decl.children, context);
6813
6598
  }
6814
6599
  function resolveTemplateSlotCondition(node, context) {
6815
6600
  const ifDirective = node.props.find((prop) => prop.type === NodeTypes.DIRECTIVE && prop.name === "if" && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION);
@@ -6847,12 +6632,6 @@ function pushSlotNamesAttr(attrs, slotNames, context) {
6847
6632
  function shouldExposePlainSlotPresence(node) {
6848
6633
  return node.tag === "component";
6849
6634
  }
6850
- function isWevuComponentTag(node, context) {
6851
- return context.wevuComponentTags ? context.wevuComponentTags.has(node.tag) : /^[A-Z]/.test(node.tag);
6852
- }
6853
- function buildScopedSlotOwnerIdExpression(context) {
6854
- return context.rewriteScopedSlot ? `${WEVU_GENERIC_SLOT_OWNER_ID_ATTR} || ${WEVU_SLOT_OWNER_ID_KEY} || ''` : `${WEVU_SLOT_OWNER_ID_KEY} || ''`;
6855
- }
6856
6635
  function shouldTransformAsComponentWithSlots(node, context, resolvedTag = resolveTemplateTagName(node.tag, context)) {
6857
6636
  const slotDirective = findSlotDirective(node);
6858
6637
  const templateSlotChildren = node.children.filter((child) => child.type === NodeTypes.ELEMENT && child.tag === "template" && findSlotDirective(child));
@@ -6862,7 +6641,6 @@ function shouldTransformAsComponentWithSlots(node, context, resolvedTag = resolv
6862
6641
  }
6863
6642
  function transformComponentWithSlots(node, context, transformNode, options) {
6864
6643
  if (isScopedSlotsDisabled(context)) return transformComponentWithSlotsFallback(node, context, transformNode, options);
6865
- if (node.tag !== "component" && context.wevuComponentTags && !isWevuComponentTag(node, context)) return transformComponentWithSlotsFallback(node, context, transformNode, options);
6866
6644
  const extraAttrs = options?.extraAttrs ?? [];
6867
6645
  const slotDeclarations = [];
6868
6646
  const slotDirective = findSlotDirective(node);
@@ -6902,25 +6680,18 @@ function transformComponentWithSlots(node, context, transformNode, options) {
6902
6680
  }
6903
6681
  const scopedSlotDeclarations = [];
6904
6682
  const plainSlotDeclarations = [];
6905
- for (const decl of slotDeclarations) if (Object.keys(decl.props).length > 0 || shouldAugmentPlainSlot(decl, context)) scopedSlotDeclarations.push(decl);
6683
+ for (const decl of slotDeclarations) if (Object.keys(decl.props).length > 0 || shouldAugmentPlainDefaultSlot(decl, context, node)) scopedSlotDeclarations.push(decl);
6906
6684
  else plainSlotDeclarations.push(decl);
6907
6685
  const slotNames = [];
6908
6686
  const slotGenericAttrs = [];
6909
6687
  for (const decl of scopedSlotDeclarations) {
6910
6688
  const slotKey = resolveSlotKey(context, decl.name);
6911
- const { componentName, asset } = createScopedSlotComponent(context, slotKey, decl.props, decl.children, transformNode);
6689
+ const { componentName } = createScopedSlotComponent(context, slotKey, decl.props, decl.children, transformNode);
6912
6690
  slotNames.push({
6913
6691
  name: stringifySlotName(decl.name, context),
6914
6692
  condition: decl.condition
6915
6693
  });
6916
6694
  slotGenericAttrs.push(`generic:scoped-slots-${slotKey}="${componentName}"`);
6917
- if (asset.ownerPropsExpression) {
6918
- const ownerPropsRef = registerRuntimeBindingExpression(asset.ownerPropsExpression, context, {
6919
- hint: "scoped slot owner props",
6920
- prefix: "wvslotownerprops"
6921
- });
6922
- slotGenericAttrs.push(`${WEVU_GENERIC_SLOT_OWNER_PROPS_ATTR}="${renderMustache(ownerPropsRef ?? asset.ownerPropsExpression, context)}"`);
6923
- }
6924
6695
  }
6925
6696
  if (shouldExposePlainSlotPresence(node) || isWevuComponentTag(node, context)) for (const decl of plainSlotDeclarations) slotNames.push({
6926
6697
  name: stringifySlotName(decl.name, context),
@@ -6939,22 +6710,12 @@ function transformComponentWithSlots(node, context, transformNode, options) {
6939
6710
  pushSlotNamesAttr(mergedAttrs, slotNames, context);
6940
6711
  if (scopedSlotDeclarations.length) {
6941
6712
  const scopePropsExp = buildScopePropsExpression(context);
6942
- if (scopePropsExp) mergedAttrs.push(`${WEVU_GENERIC_SLOT_SCOPE_ATTR}="${renderMustache(scopePropsExp, context)}"`);
6943
- const ownerIdExp = renderMustache(buildScopedSlotOwnerIdExpression(context), context);
6944
- mergedAttrs.push(`${WEVU_GENERIC_SLOT_OWNER_ID_ATTR}="${ownerIdExp}"`);
6945
- }
6946
- const { tag } = node;
6947
- const nativeSlotContext = plainSlotDeclarations.length ? createNativeSlotContext(context) : context;
6948
- const plainSlotContent = plainSlotDeclarations.map((decl) => renderSlotFallback(decl, nativeSlotContext, transformNode)).join("");
6949
- const nativeSlotBindings = nativeSlotContext.nativeSlotScopeRuntime?.bindings;
6950
- if (nativeSlotBindings?.size) {
6951
- const bindingEntries = Array.from(nativeSlotBindings);
6952
- const scopeExp = `[${bindingEntries.map(([key, value]) => `'${key}',${value}`).join(",")}]`;
6953
- mergedAttrs.push(`${WEVU_GENERIC_SLOT_SCOPE_ATTR}="${renderMustache(scopeExp, context)}"`);
6954
- const readyExp = bindingEntries.map(([key]) => `${key}!==undefined`).join("&&");
6955
- if (readyExp) mergedAttrs.push(`${context.platform.directives.ifAttr}="${renderMustache(readyExp, context)}"`);
6713
+ if (scopePropsExp) mergedAttrs.push(`${WEVU_SLOT_SCOPE_ATTR}="${renderMustache(scopePropsExp, context)}"`);
6714
+ mergedAttrs.push(`${WEVU_SLOT_OWNER_ID_ATTR}="${renderMustache(`${WEVU_SLOT_OWNER_ID_KEY} || ''`, context)}"`);
6956
6715
  }
6957
6716
  const attrString = mergedAttrs.length ? ` ${mergedAttrs.join(" ")}` : "";
6717
+ const { tag } = node;
6718
+ const plainSlotContent = plainSlotDeclarations.map((decl) => renderSlotFallback(decl, context, transformNode)).join("");
6958
6719
  return plainSlotContent ? `<${tag}${attrString}>${plainSlotContent}</${tag}>` : `<${tag}${attrString} />`;
6959
6720
  }
6960
6721
  function transformComponentWithSlotsFallback(node, context, transformNode, options) {
@@ -7064,16 +6825,6 @@ function transformNormalElement(node, context, transformNode) {
7064
6825
  //#region src/plugins/vue/compiler/template/elements/tag-structural.ts
7065
6826
  const REGEX_SPECIAL_CHARS_RE = /[.*+?^${}()|[\]\\]/g;
7066
6827
  function resolveConditionExpression$1(rawExpValue, context, hint) {
7067
- if (context.nativeSlotScopeRuntime) {
7068
- const runtimeExp = registerRuntimeBindingExpression(rawExpValue, context.nativeSlotScopeRuntime.owner, {
7069
- hint,
7070
- prefix: context.nativeSlotScopeRuntime.runtimeBindingPrefix
7071
- });
7072
- if (runtimeExp) {
7073
- context.nativeSlotScopeRuntime.bindings.set(runtimeExp, runtimeExp);
7074
- return runtimeExp;
7075
- }
7076
- }
7077
6828
  return (shouldFallbackToRuntimeBinding(rawExpValue) ? registerRuntimeBindingExpression(rawExpValue, context, { hint }) : null) ?? normalizeWxmlExpressionWithContext(rawExpValue, context);
7078
6829
  }
7079
6830
  function transformIfElement(node, context, transformNode) {
@@ -7263,16 +7014,6 @@ function transformInterpolation(node, context) {
7263
7014
  const { content } = node;
7264
7015
  if (content.type === NodeTypes.SIMPLE_EXPRESSION) {
7265
7016
  const rawExpValue = content.content;
7266
- if (context.nativeSlotScopeRuntime) {
7267
- const runtimeExp = registerRuntimeBindingExpression(rawExpValue, context.nativeSlotScopeRuntime.owner, {
7268
- hint: "插值表达式",
7269
- prefix: context.nativeSlotScopeRuntime.runtimeBindingPrefix
7270
- });
7271
- if (runtimeExp) {
7272
- context.nativeSlotScopeRuntime.bindings.set(runtimeExp, runtimeExp);
7273
- return renderMustache(runtimeExp, context);
7274
- }
7275
- }
7276
7017
  return renderMustache((shouldFallbackToRuntimeBinding(rawExpValue) ? registerRuntimeBindingExpression(rawExpValue, context, { hint: "插值表达式" }) : null) ?? normalizeWxmlExpressionWithContext(rawExpValue, context), context);
7277
7018
  }
7278
7019
  /* istanbul ignore next */
@@ -7345,8 +7086,6 @@ function compileVueTemplateToWxml(template, filename, options) {
7345
7086
  objectLiteralBindMode: options?.objectLiteralBindMode ?? "runtime",
7346
7087
  mustacheInterpolation: options?.mustacheInterpolation ?? "compact",
7347
7088
  classStyleBindings: [],
7348
- runtimeBindingCache: /* @__PURE__ */ new Map(),
7349
- runtimeBindingPrefix: "__wv_bind_",
7350
7089
  classStyleWxs: false,
7351
7090
  classStyleWxsExtension: wxsExtension,
7352
7091
  classStyleWxsSrc: options?.classStyleWxsSrc,
@@ -8298,11 +8037,15 @@ async function compileVueFile(source, filename, options) {
8298
8037
  autoUsingComponents,
8299
8038
  autoImportTags
8300
8039
  });
8301
- const templateOptions = componentSourceInfo.wevuComponentTags.size ? {
8040
+ const baseTemplateOptions = parsed.isAppFile ? {
8302
8041
  ...options?.template,
8042
+ scopedSlotsRequireProps: true
8043
+ } : options?.template;
8044
+ const templateOptions = componentSourceInfo.wevuComponentTags.size ? {
8045
+ ...baseTemplateOptions,
8303
8046
  wevuComponentTags: componentSourceInfo.wevuComponentTags
8304
8047
  } : {
8305
- ...options?.template,
8048
+ ...baseTemplateOptions,
8306
8049
  wevuComponentTags: []
8307
8050
  };
8308
8051
  const templateCompiled = compileTemplatePhase(parsed.descriptor, filename, templateOptions, result);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "6.16.8",
4
+ "version": "6.16.10",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -50,9 +50,9 @@
50
50
  "merge": "^2.1.1",
51
51
  "pathe": "^2.0.3",
52
52
  "vue": "^3.5.34",
53
- "@weapp-core/constants": "^0.1.5",
53
+ "@weapp-core/constants": "^0.1.6",
54
54
  "@weapp-core/shared": "3.0.4",
55
- "@weapp-vite/ast": "6.16.8",
55
+ "@weapp-vite/ast": "6.16.10",
56
56
  "rolldown-require": "2.0.15"
57
57
  },
58
58
  "publishConfig": {