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

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.2
2
+ * @vue/compiler-sfc v3.6.0-rc.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -388,7 +388,7 @@ const isBlockTag = /* @__PURE__ */ makeMap(BLOCK_TAGS);
388
388
  /**
389
389
  * The full list is needed during SSR to produce the correct initial markup.
390
390
  */
391
- const isBooleanAttr = /* @__PURE__ */ makeMap("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
391
+ const isBooleanAttr = /* @__PURE__ */ makeMap("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly,async,autofocus,autoplay,controls,default,defer,disabled,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");
392
392
  /**
393
393
  * Boolean attributes should be included if the value is truthy or ''.
394
394
  * e.g. `<select multiple>` compiles to `{ multiple: '' }`
@@ -3607,7 +3607,7 @@ const errorMessages$1 = {
3607
3607
  [54]: ``
3608
3608
  };
3609
3609
  //#endregion
3610
- //#region node_modules/.pnpm/@babel+parser@7.29.7/node_modules/@babel/parser/lib/index.js
3610
+ //#region node_modules/.pnpm/@babel+parser@7.29.8/node_modules/@babel/parser/lib/index.js
3611
3611
  var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3612
3612
  Object.defineProperty(exports, "__esModule", { value: true });
3613
3613
  function _objectWithoutPropertiesLoose(r, e) {
@@ -3794,6 +3794,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3794
3794
  SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
3795
3795
  SourcePhaseImportRequiresDefault: "Only `import source x from \"./module\"` is valid.",
3796
3796
  StaticPrototype: "Classes may not have static property named prototype.",
3797
+ SuperCallNotNewExpression: "Cannot use new with super(...).",
3797
3798
  SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
3798
3799
  SuperPrivateField: "Private fields can't be accessed on super.",
3799
3800
  TrailingDecorator: "Decorators must be attached to a class element.",
@@ -3816,7 +3817,6 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3816
3817
  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
3817
3818
  UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
3818
3819
  UnexpectedVoidPattern: "Unexpected void binding.",
3819
- UnsupportedBind: "Binding should be performed on object property.",
3820
3820
  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
3821
3821
  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
3822
3822
  UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
@@ -3872,6 +3872,10 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3872
3872
  PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
3873
3873
  PrimaryTopicRequiresSmartPipeline: "Topic reference is used, but the pipelineOperator plugin was not passed a \"proposal\": \"hack\" or \"smart\" option."
3874
3874
  });
3875
+ var FunctionBindErrors = {
3876
+ UnsupportedBind: "Binding should be performed on object property.",
3877
+ UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
3878
+ };
3875
3879
  const _excluded = ["message"];
3876
3880
  function defineHidden(obj, key, value) {
3877
3881
  Object.defineProperty(obj, key, {
@@ -3936,7 +3940,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3936
3940
  }
3937
3941
  return ParseErrorConstructors;
3938
3942
  }
3939
- const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
3943
+ const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors), ParseErrorEnum`functionBind`(FunctionBindErrors));
3940
3944
  function createDefaultOptions() {
3941
3945
  return {
3942
3946
  sourceType: "script",
@@ -13511,7 +13515,7 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
13511
13515
  }
13512
13516
  parseSubscript(base, startLoc, noCalls, state) {
13513
13517
  const { type } = this.state;
13514
- if (!noCalls && type === 15) return this.parseBind(base, startLoc, noCalls, state);
13518
+ if (!noCalls && type === 15) return this.parseBind(base, startLoc, state);
13515
13519
  else if (tokenIsTemplate(type)) return this.parseTaggedTemplateExpression(base, startLoc, state);
13516
13520
  let optional = false;
13517
13521
  if (type === 18) {
@@ -13550,13 +13554,16 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
13550
13554
  return this.finishNode(node, "OptionalMemberExpression");
13551
13555
  } else return this.finishNode(node, "MemberExpression");
13552
13556
  }
13553
- parseBind(base, startLoc, noCalls, state) {
13557
+ parseBind(base, startLoc, state) {
13554
13558
  const node = this.startNodeAt(startLoc);
13555
13559
  node.object = base;
13556
13560
  this.next();
13557
- node.callee = this.parseNoCallExpr();
13561
+ const isImport = this.match(83);
13562
+ const callee = this.parseNoCallExpr();
13563
+ if (callee.type === "Super" || isImport && callee.type === "ImportExpression" || callee.type === "Import") throw this.raise(Errors.UnsupportedBindRHS, callee);
13564
+ node.callee = callee;
13558
13565
  state.stop = true;
13559
- return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, noCalls);
13566
+ return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, false);
13560
13567
  }
13561
13568
  parseCoverCallAndAsyncArrowHead(base, startLoc, state, optional) {
13562
13569
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
@@ -14013,7 +14020,8 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
14013
14020
  const isImport = this.match(83);
14014
14021
  const callee = this.parseNoCallExpr();
14015
14022
  node.callee = callee;
14016
- if (isImport && (callee.type === "Import" || callee.type === "ImportExpression")) this.raise(Errors.ImportCallNotNewExpression, callee);
14023
+ if (isImport && callee.type === "ImportExpression" || callee.type === "Import") this.raise(Errors.ImportCallNotNewExpression, callee);
14024
+ if (callee.type === "Super") this.raise(Errors.SuperCallNotNewExpression, callee);
14017
14025
  }
14018
14026
  parseTemplateElement(isTagged) {
14019
14027
  const { start, startLoc, end, value } = this.state;
@@ -20818,15 +20826,22 @@ const transformFor = createStructuralDirectiveTransform$1("for", (node, dir, con
20818
20826
  else {
20819
20827
  childBlock = children[0].codegenNode;
20820
20828
  if (isTemplate && keyProperty) injectProp(childBlock, keyProperty, context);
20821
- if (childBlock.isBlock !== !isStableFragment) if (childBlock.isBlock) {
20829
+ const shouldUseBlock = !isStableFragment || childBlock.isBlockRequired === true;
20830
+ if (childBlock.isBlock !== shouldUseBlock) if (childBlock.isBlock) {
20822
20831
  removeHelper(OPEN_BLOCK);
20823
20832
  removeHelper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
20824
20833
  } else removeHelper(getVNodeHelper(context.inSSR, childBlock.isComponent));
20825
- childBlock.isBlock = !isStableFragment;
20834
+ childBlock.isBlock = shouldUseBlock;
20826
20835
  if (childBlock.isBlock) {
20827
20836
  helper(OPEN_BLOCK);
20828
20837
  helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent));
20829
- } else helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
20838
+ } else {
20839
+ helper(getVNodeHelper(context.inSSR, childBlock.isComponent));
20840
+ if (childBlock.needsPatch) {
20841
+ var _childBlock$patchFlag;
20842
+ childBlock.patchFlag = ((_childBlock$patchFlag = childBlock.patchFlag) !== null && _childBlock$patchFlag !== void 0 ? _childBlock$patchFlag : 0) | 512;
20843
+ }
20844
+ }
20830
20845
  }
20831
20846
  if (memo) {
20832
20847
  const loop = createFunctionExpression(createForLoopParams(forNode.parseResult, [createSimpleExpression(`_cached`)]));
@@ -21082,12 +21097,16 @@ const transformElement$1 = (node, context) => {
21082
21097
  let vnodeDynamicProps;
21083
21098
  let dynamicPropNames;
21084
21099
  let vnodeDirectives;
21100
+ let needsPatch = false;
21101
+ let isBlockRequired = false;
21085
21102
  let shouldUseBlock = isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent && (tag === "svg" || tag === "foreignObject" || tag === "math");
21086
21103
  if (props.length > 0) {
21087
21104
  const propsBuildResult = buildProps$1(node, context, void 0, isComponent, isDynamicComponent);
21088
21105
  vnodeProps = propsBuildResult.props;
21089
21106
  patchFlag = propsBuildResult.patchFlag;
21090
21107
  dynamicPropNames = propsBuildResult.dynamicPropNames;
21108
+ needsPatch = propsBuildResult.needsPatch;
21109
+ isBlockRequired = propsBuildResult.isBlockRequired;
21091
21110
  const directives = propsBuildResult.directives;
21092
21111
  vnodeDirectives = directives && directives.length ? createArrayExpression(directives.map((dir) => buildDirectiveArgs(dir, context))) : void 0;
21093
21112
  if (propsBuildResult.shouldUseBlock) shouldUseBlock = true;
@@ -21116,7 +21135,10 @@ const transformElement$1 = (node, context) => {
21116
21135
  } else vnodeChildren = node.children;
21117
21136
  }
21118
21137
  if (dynamicPropNames && dynamicPropNames.length) vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames);
21119
- node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
21138
+ const vnodeCall = node.codegenNode = createVNodeCall(context, vnodeTag, vnodeProps, vnodeChildren, patchFlag === 0 ? void 0 : patchFlag, vnodeDynamicProps, vnodeDirectives, !!shouldUseBlock, false, isComponent, node.loc);
21139
+ needsPatch = needsPatch && (patchFlag === 0 || patchFlag === 32);
21140
+ if (needsPatch) vnodeCall.needsPatch = true;
21141
+ if (isBlockRequired) vnodeCall.isBlockRequired = true;
21120
21142
  };
21121
21143
  };
21122
21144
  function resolveComponentType(node, context, ssr = false) {
@@ -21201,6 +21223,7 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21201
21223
  const runtimeDirectives = [];
21202
21224
  const hasChildren = children.length > 0;
21203
21225
  let shouldUseBlock = false;
21226
+ let isBlockRequired = false;
21204
21227
  let patchFlag = 0;
21205
21228
  let hasRef = false;
21206
21229
  let hasClassBinding = false;
@@ -21225,12 +21248,12 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21225
21248
  const isEventHandler = isOn(name);
21226
21249
  if (isEventHandler && (!isComponent || isDynamicComponent) && name.toLowerCase() !== "onclick" && name !== "onUpdate:modelValue" && !isReservedProp$1(name)) hasHydrationEventBinding = true;
21227
21250
  if (isEventHandler && isReservedProp$1(name)) hasVnodeHook = true;
21251
+ if (name === "ref") hasRef = true;
21228
21252
  if (isEventHandler && value.type === 14) value = value.arguments[0];
21229
21253
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) return;
21230
- if (name === "ref") hasRef = true;
21231
- else if (name === "class") hasClassBinding = true;
21254
+ if (name === "class") hasClassBinding = true;
21232
21255
  else if (name === "style") hasStyleBinding = true;
21233
- else if (name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
21256
+ else if (name !== "ref" && name !== "key" && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
21234
21257
  if (isComponent && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) dynamicPropNames.push(name);
21235
21258
  } else hasDynamicKeys = true;
21236
21259
  };
@@ -21263,7 +21286,11 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21263
21286
  if (name === "once" || name === "memo") continue;
21264
21287
  if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag$1(tag) || false)) continue;
21265
21288
  if (isVOn && ssr) continue;
21266
- if (isVBind && isStaticArgOf(arg, "key") || isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update")) shouldUseBlock = true;
21289
+ if (isVBind && isStaticArgOf(arg, "key")) shouldUseBlock = true;
21290
+ if (isVOn && hasChildren && arg && isStaticExp(arg) && camelize(arg.content) === "vue:beforeUpdate") {
21291
+ shouldUseBlock = true;
21292
+ isBlockRequired = true;
21293
+ }
21267
21294
  if (isVBind && isStaticArgOf(arg, "ref")) pushRefVForMarker();
21268
21295
  if (!arg && (isVBind || isVOn)) {
21269
21296
  hasDynamicKeys = true;
@@ -21293,7 +21320,10 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21293
21320
  }
21294
21321
  } else if (!isBuiltInDirective(name)) {
21295
21322
  runtimeDirectives.push(prop);
21296
- if (hasChildren) shouldUseBlock = true;
21323
+ if (hasChildren) {
21324
+ shouldUseBlock = true;
21325
+ isBlockRequired = true;
21326
+ }
21297
21327
  }
21298
21328
  }
21299
21329
  }
@@ -21310,7 +21340,8 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21310
21340
  if (dynamicPropNames.length) patchFlag |= 8;
21311
21341
  if (hasHydrationEventBinding) patchFlag |= 32;
21312
21342
  }
21313
- if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) patchFlag |= 512;
21343
+ const needsPatch = (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0);
21344
+ if (!shouldUseBlock && needsPatch) patchFlag |= 512;
21314
21345
  if (!context.inSSR && propsExpression) switch (propsExpression.type) {
21315
21346
  case 15:
21316
21347
  let classKeyIndex = -1;
@@ -21340,7 +21371,9 @@ function buildProps$1(node, context, props = node.props, isComponent, isDynamicC
21340
21371
  directives: runtimeDirectives,
21341
21372
  patchFlag,
21342
21373
  dynamicPropNames,
21343
- shouldUseBlock
21374
+ shouldUseBlock,
21375
+ needsPatch,
21376
+ isBlockRequired
21344
21377
  };
21345
21378
  }
21346
21379
  function dedupeProperties$1(properties) {
@@ -22223,10 +22256,11 @@ function stringifyElement(node, context) {
22223
22256
  res += ` ${p.arg.content}="__VUE_EXP_START__${exp.content}__VUE_EXP_END__"`;
22224
22257
  continue;
22225
22258
  }
22226
- if (isBooleanAttr(p.arg.content) && exp.content === "false") continue;
22259
+ if ((isBooleanAttr(p.arg.content) || p.arg.content === "hidden") && exp.content === "false") continue;
22227
22260
  let evaluated = evaluateConstant(exp);
22228
22261
  if (evaluated != null) {
22229
22262
  const arg = p.arg && p.arg.content;
22263
+ if (arg === "hidden" && typeof evaluated === "number" && !includeBooleanAttr(evaluated)) continue;
22230
22264
  if (arg === "class") evaluated = normalizeClass(evaluated);
22231
22265
  else if (arg === "style") evaluated = stringifyStyle(normalizeStyle(evaluated));
22232
22266
  res += ` ${p.arg.content}="${escapeHtml(evaluated)}"`;
@@ -22980,6 +23014,16 @@ function createCache(max = 500) {
22980
23014
  return /* @__PURE__ */ new Map();
22981
23015
  }
22982
23016
  //#endregion
23017
+ //#region packages/compiler-sfc/src/template/resolveTemplateAST.ts
23018
+ function resolveTemplateAST(inAST, options) {
23019
+ if (!(inAST === null || inAST === void 0 ? void 0 : inAST.transformed)) return inAST;
23020
+ const { compiler = src_exports$2, compilerOptions, ssr, onError } = options;
23021
+ return createRoot((ssr ? src_exports$2 : compiler).parse(inAST.source, _objectSpread2(_objectSpread2({ prefixIdentifiers: true }, compilerOptions), {}, {
23022
+ parseMode: "sfc",
23023
+ onError
23024
+ })).children.find((node) => node.type === 1 && node.tag === "template").children, inAST.source);
23025
+ }
23026
+ //#endregion
22983
23027
  //#region packages/compiler-sfc/src/script/importUsageCheck.ts
22984
23028
  /**
22985
23029
  * Check if an identifier is used in the SFC's template.
@@ -22987,23 +23031,28 @@ function createCache(max = 500) {
22987
23031
  * when not using inline mode.
22988
23032
  * - 2.check whether the built-in properties such as $attrs, $slots, $emit are used in the template
22989
23033
  */
22990
- function isUsedInTemplate(identifier, sfc) {
22991
- return resolveTemplateUsedIdentifiers(sfc).has(identifier);
23034
+ function isUsedInTemplate(identifier, sfc, options) {
23035
+ return resolveTemplateUsedIdentifiers(sfc, options).has(identifier);
22992
23036
  }
22993
23037
  const templateAnalysisCache = createCache();
22994
- function resolveTemplateVModelIdentifiers(sfc) {
22995
- return resolveTemplateAnalysisResult(sfc, false).vModelIds;
23038
+ function resolveTemplateVModelIdentifiers(sfc, options) {
23039
+ return resolveTemplateAnalysisResult(sfc, false, options).vModelIds;
22996
23040
  }
22997
- function resolveTemplateUsedIdentifiers(sfc) {
22998
- return resolveTemplateAnalysisResult(sfc).usedIds;
23041
+ function resolveTemplateUsedIdentifiers(sfc, options) {
23042
+ return resolveTemplateAnalysisResult(sfc, true, options).usedIds;
22999
23043
  }
23000
- function resolveTemplateAnalysisResult(sfc, collectUsedIds = true) {
23044
+ function resolveTemplateAnalysisResult(sfc, collectUsedIds = true, options) {
23001
23045
  const { content, ast } = sfc.template;
23002
23046
  const cached = templateAnalysisCache.get(content);
23003
23047
  if (cached && (!collectUsedIds || cached.usedIds)) return cached;
23004
23048
  const ids = collectUsedIds ? /* @__PURE__ */ new Set() : void 0;
23005
23049
  const vModelIds = /* @__PURE__ */ new Set();
23006
- ast.children.forEach(walk);
23050
+ resolveTemplateAST(ast, {
23051
+ compiler: options === null || options === void 0 ? void 0 : options.compiler,
23052
+ compilerOptions: options === null || options === void 0 ? void 0 : options.compilerOptions,
23053
+ ssr: options === null || options === void 0 ? void 0 : options.ssr,
23054
+ onError: () => {}
23055
+ }).children.forEach(walk);
23007
23056
  function walk(node) {
23008
23057
  switch (node.type) {
23009
23058
  case 1:
@@ -23058,6 +23107,7 @@ function extractIdentifiers$1(ids, node) {
23058
23107
  }
23059
23108
  //#endregion
23060
23109
  //#region packages/compiler-sfc/src/parse.ts
23110
+ init_objectSpread2();
23061
23111
  const DEFAULT_FILENAME = "anonymous.vue";
23062
23112
  const parseCache$1 = createCache();
23063
23113
  function parse(source, options = {}) {
@@ -24756,22 +24806,20 @@ const IRNodeTypes = {
24756
24806
  "9": "SET_TEMPLATE_REF",
24757
24807
  "INSERT_NODE": 10,
24758
24808
  "10": "INSERT_NODE",
24759
- "PREPEND_NODE": 11,
24760
- "11": "PREPEND_NODE",
24761
- "CREATE_COMPONENT_NODE": 12,
24762
- "12": "CREATE_COMPONENT_NODE",
24763
- "SLOT_OUTLET_NODE": 13,
24764
- "13": "SLOT_OUTLET_NODE",
24765
- "DIRECTIVE": 14,
24766
- "14": "DIRECTIVE",
24767
- "IF": 15,
24768
- "15": "IF",
24769
- "FOR": 16,
24770
- "16": "FOR",
24771
- "KEY": 17,
24772
- "17": "KEY",
24773
- "GET_TEXT_CHILD": 18,
24774
- "18": "GET_TEXT_CHILD"
24809
+ "CREATE_COMPONENT_NODE": 11,
24810
+ "11": "CREATE_COMPONENT_NODE",
24811
+ "SLOT_OUTLET_NODE": 12,
24812
+ "12": "SLOT_OUTLET_NODE",
24813
+ "DIRECTIVE": 13,
24814
+ "13": "DIRECTIVE",
24815
+ "IF": 14,
24816
+ "14": "IF",
24817
+ "FOR": 15,
24818
+ "15": "FOR",
24819
+ "KEY": 16,
24820
+ "16": "KEY",
24821
+ "GET_TEXT_CHILD": 17,
24822
+ "17": "GET_TEXT_CHILD"
24775
24823
  };
24776
24824
  var TemplateRegistry = class {
24777
24825
  constructor() {
@@ -24793,7 +24841,7 @@ const DynamicFlag = {
24793
24841
  };
24794
24842
  function isBlockOperation(op) {
24795
24843
  const type = op.type;
24796
- return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
24844
+ return type === 11 || type === 12 || type === 14 || type === 16 || type === 15;
24797
24845
  }
24798
24846
  //#endregion
24799
24847
  //#region packages/compiler-vapor/src/transforms/utils.ts
@@ -25414,9 +25462,6 @@ function genInsertNode({ parent, elements, anchor }, { helper }) {
25414
25462
  if (elements.length > 1) element = `[${element}]`;
25415
25463
  return [NEWLINE, ...genCall(helper("insert"), element, `n${parent}`, anchor === void 0 ? void 0 : `n${anchor}`)];
25416
25464
  }
25417
- function genPrependNode(oper, { helper }) {
25418
- return [NEWLINE, ...genCall(helper("prepend"), `n${oper.parent}`, ...oper.elements.map((el) => `n${el}`))];
25419
- }
25420
25465
  //#endregion
25421
25466
  //#region packages/compiler-vapor/src/generators/expression.ts
25422
25467
  init_objectSpread2();
@@ -25906,7 +25951,10 @@ function extractMemberExpression(exp, onIdentifier) {
25906
25951
  case "CallExpression": return `${extractMemberExpression(exp.callee, onIdentifier)}(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
25907
25952
  case "OptionalCallExpression": return `${extractMemberExpression(exp.callee, onIdentifier)}?.(${exp.arguments.map((arg) => extractMemberExpression(arg, onIdentifier)).join(", ")})`;
25908
25953
  case "MemberExpression":
25909
- case "OptionalMemberExpression": return `${extractMemberExpression(exp.object, onIdentifier)}${exp.computed ? `[${extractMemberExpression(exp.property, onIdentifier)}]` : `.${extractMemberExpression(exp.property, NOOP)}`}`;
25954
+ case "OptionalMemberExpression":
25955
+ const object = extractMemberExpression(exp.object, onIdentifier);
25956
+ const optional = exp.type === "OptionalMemberExpression" && exp.optional;
25957
+ return `${object}${exp.computed ? `${optional ? "?." : ""}[${extractMemberExpression(exp.property, onIdentifier)}]` : `${optional ? "?." : "."}${extractMemberExpression(exp.property, NOOP)}`}`;
25910
25958
  case "TSNonNullExpression": return `${extractMemberExpression(exp.expression, onIdentifier)}`;
25911
25959
  default: return "";
25912
25960
  }
@@ -26166,7 +26214,7 @@ function isFragmentBlock(block) {
26166
26214
  const child = getSingleReturnedChild(block);
26167
26215
  const operation = child && child.operation;
26168
26216
  if (!operation) return false;
26169
- return operation.type === 13 || operation.type === 16 || operation.type === 17 || operation.type === 15 && !operation.once || operation.type === 12 && !!operation.dynamic && !operation.dynamic.isStatic;
26217
+ return operation.type === 12 || operation.type === 15 || operation.type === 16 || operation.type === 14 && !operation.once || operation.type === 11 && !!operation.dynamic && !operation.dynamic.isStatic;
26170
26218
  }
26171
26219
  function getSingleReturnedChild(block) {
26172
26220
  if (block.returns.length !== 1) return;
@@ -26345,8 +26393,8 @@ function isKeyOnlyBinding(expr, key, source) {
26345
26393
  //#region packages/compiler-vapor/src/generators/html.ts
26346
26394
  function genSetHtml(oper, context) {
26347
26395
  const { helper } = context;
26348
- const { value, element, isComponent } = oper;
26349
- return [NEWLINE, ...genCall(isComponent ? helper("setBlockHtml") : helper("setHtml"), `n${element}`, genExpression(value, context))];
26396
+ const { value, element } = oper;
26397
+ return [NEWLINE, ...genCall(helper("setHtml"), `n${element}`, genExpression(value, context))];
26350
26398
  }
26351
26399
  //#endregion
26352
26400
  //#region packages/compiler-vapor/src/generators/if.ts
@@ -26648,9 +26696,9 @@ function genRefValue(value, context) {
26648
26696
  //#region packages/compiler-vapor/src/generators/text.ts
26649
26697
  function genSetText(oper, context) {
26650
26698
  const { helper } = context;
26651
- const { element, values, generated, isComponent } = oper;
26699
+ const { element, values, generated } = oper;
26652
26700
  const texts = combineValues(values, context);
26653
- return [NEWLINE, ...genCall(isComponent ? helper("setBlockText") : helper("setText"), `${generated && !isComponent ? "x" : "n"}${element}`, texts)];
26701
+ return [NEWLINE, ...genCall(helper("setText"), `${generated ? "x" : "n"}${element}`, texts)];
26654
26702
  }
26655
26703
  function combineValues(values, context) {
26656
26704
  return values.flatMap((value, i) => {
@@ -26725,7 +26773,11 @@ function genCustomDirectives(opers, context) {
26725
26773
  return [NEWLINE, ...genCall(helper("withVaporDirectives"), element, directives)];
26726
26774
  function genDirectiveItem({ dir, name, asset }) {
26727
26775
  const directiveVar = asset ? toValidAssetId(name, "directive") : genExpression(extend(createSimpleExpression(name, false), { ast: null }), context);
26728
- const value = dir.exp && ["() => ", ...genExpression(dir.exp, context)];
26776
+ const value = dir.exp && [
26777
+ "() => (",
26778
+ ...genExpression(dir.exp, context),
26779
+ ")"
26780
+ ];
26729
26781
  const argument = dir.arg && genExpression(dir.arg, context);
26730
26782
  const modifiers = !!dir.modifiers.length && [
26731
26783
  "{ ",
@@ -26736,7 +26788,7 @@ function genCustomDirectives(opers, context) {
26736
26788
  }
26737
26789
  }
26738
26790
  function filterCustomDirectives(id, operations) {
26739
- return operations.filter((oper) => oper.type === 14 && oper.element === id && !oper.builtin);
26791
+ return operations.filter((oper) => oper.type === 13 && oper.element === id && !oper.builtin);
26740
26792
  }
26741
26793
  //#endregion
26742
26794
  //#region packages/compiler-vapor/src/generators/component.ts
@@ -26969,7 +27021,8 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
26969
27021
  if (frags.length) return genMulti(DELIMITERS_ARRAY_NEWLINE, ...frags);
26970
27022
  }
26971
27023
  function genProp(prop, context, isStatic, wrapHandler = true, directStaticLiteral = false) {
26972
- const values = genPropValue(prop.values, context);
27024
+ let values = genPropValue(prop.values, context);
27025
+ if (prop.toDisplayString) values = genCall(context.helper("toDisplayString"), values);
26973
27026
  return [
26974
27027
  ...genPropKey(prop, context),
26975
27028
  ": ",
@@ -27123,7 +27176,7 @@ function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
27123
27176
  if (propsName) idMap[propsName] = null;
27124
27177
  const exitSlotBlock = context.enterSlotBlock();
27125
27178
  const hasStableRoot = hasStableSlotRoot(oper, context);
27126
- if (!hasStableRoot) markSlotRootOperations(oper);
27179
+ if (!hasStableRoot) markSlotRootOperations(oper, context);
27127
27180
  let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
27128
27181
  if (emitNonStableFlag && !hasStableRoot) blockFn = genCall(context.helper("extend"), blockFn, [`{ _: ${genSlotFlags$1(8)} }`]);
27129
27182
  exitSlotBlock();
@@ -27138,40 +27191,6 @@ function genSlotFlags$1(flags) {
27138
27191
  if (flags & 8) names.push("NON_STABLE");
27139
27192
  return `${flags} /* ${names.join(", ")} */`;
27140
27193
  }
27141
- const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
27142
- function hasStableSlotRoot(block, context) {
27143
- let hasValidRoot = false;
27144
- for (let i = 0; i < block.returns.length; i++) {
27145
- const id = block.returns[i];
27146
- const child = findReturnedDynamic$1(block, id);
27147
- const operation = child && child.operation;
27148
- if (!operation) {
27149
- if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
27150
- continue;
27151
- }
27152
- switch (operation.type) {
27153
- case 12:
27154
- if (!operation.dynamic || operation.dynamic.isStatic) {
27155
- hasValidRoot = true;
27156
- continue;
27157
- }
27158
- continue;
27159
- case 17:
27160
- if (hasStableSlotRoot(operation.block, context)) {
27161
- hasValidRoot = true;
27162
- continue;
27163
- }
27164
- continue;
27165
- default: continue;
27166
- }
27167
- }
27168
- return hasValidRoot;
27169
- }
27170
- function isStableTemplateSlotRoot(child, context) {
27171
- if (child.template == null) return false;
27172
- const content = context.ir.template.entries[child.template].content;
27173
- return content !== "" && !commentOnlyTemplateRE.test(content.trim());
27174
- }
27175
27194
  //#endregion
27176
27195
  //#region packages/compiler-vapor/src/generators/slotOutlet.ts
27177
27196
  function genSlotOutlet(oper, context) {
@@ -27180,7 +27199,7 @@ function genSlotOutlet(oper, context) {
27180
27199
  const [frag, push] = buildCodeFragment();
27181
27200
  let fallbackArg;
27182
27201
  if (fallback) {
27183
- if (context.inSlotBlock) markSlotRootOperations(fallback);
27202
+ if (context.inSlotBlock) markSlotRootOperations(fallback, context);
27184
27203
  fallbackArg = genBlock(fallback, context);
27185
27204
  }
27186
27205
  const createSlot = helper("createSlot");
@@ -27199,19 +27218,21 @@ function genSlotFlags(flags) {
27199
27218
  if (flags & 1) names.push("NO_SLOTTED");
27200
27219
  if (flags & 2) names.push("ONCE");
27201
27220
  if (flags & 4) names.push("SLOT_ROOT");
27221
+ if (flags & 16) names.push("SHARED_FALLBACK");
27222
+ if (flags & 32) names.push("INHERIT_FALLBACK");
27202
27223
  return `${flags} /* ${names.join(", ")} */`;
27203
27224
  }
27204
27225
  //#endregion
27205
27226
  //#region packages/compiler-vapor/src/generators/key.ts
27206
27227
  function genKey(oper, context) {
27207
- const { id, value, block } = oper;
27228
+ const { id, value, block, slotRoot } = oper;
27208
27229
  const [frag, push] = buildCodeFragment();
27209
27230
  const blockFn = genBlock(block, context);
27210
27231
  push(NEWLINE, `const n${id} = `, ...genCall(context.helper("createKeyedFragment"), [
27211
27232
  `() => (`,
27212
27233
  ...genExpression(value, context),
27213
27234
  ")"
27214
- ], blockFn));
27235
+ ], blockFn, slotRoot ? "true" : false));
27215
27236
  return frag;
27216
27237
  }
27217
27238
  function genSetBlockKey(oper, context) {
@@ -27241,14 +27262,13 @@ function genOperation(oper, context) {
27241
27262
  case 8: return genSetHtml(oper, context);
27242
27263
  case 9: return genSetTemplateRef(oper, context);
27243
27264
  case 10: return genInsertNode(oper, context);
27244
- case 11: return genPrependNode(oper, context);
27245
- case 15: return genIf(oper, context);
27246
- case 16: return genFor(oper, context);
27247
- case 17: return genKey(oper, context);
27248
- case 12: return genCreateComponent(oper, context);
27249
- case 13: return genSlotOutlet(oper, context);
27250
- case 14: return genBuiltinDirective(oper, context);
27251
- case 18: return genGetTextChild(oper, context);
27265
+ case 14: return genIf(oper, context);
27266
+ case 15: return genFor(oper, context);
27267
+ case 16: return genKey(oper, context);
27268
+ case 11: return genCreateComponent(oper, context);
27269
+ case 12: return genSlotOutlet(oper, context);
27270
+ case 13: return genBuiltinDirective(oper, context);
27271
+ case 17: return genGetTextChild(oper, context);
27252
27272
  default: throw new Error(`Unhandled operation type in genOperation: ${oper}`);
27253
27273
  }
27254
27274
  }
@@ -27296,9 +27316,8 @@ function genEffect({ operations }, context) {
27296
27316
  return frag;
27297
27317
  }
27298
27318
  function genInsertionState(operation, context) {
27299
- const { parent, anchor, logicalIndex, append } = operation;
27300
- const isPrepend = anchor === -1;
27301
- return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor == null ? void 0 : isPrepend ? `0` : append ? "null" : `n${anchor}`, logicalIndex !== void 0 && (!isPrepend || logicalIndex !== 0) ? String(logicalIndex) : void 0)];
27319
+ const { parent, anchor, appendIndex } = operation;
27320
+ return [NEWLINE, ...genCall(context.helper("setInsertionState"), `n${parent}`, anchor != null ? `n${anchor}` : appendIndex ? String(appendIndex) : void 0)];
27302
27321
  }
27303
27322
  //#endregion
27304
27323
  //#region packages/compiler-vapor/src/generators/template.ts
@@ -27336,6 +27355,16 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
27336
27355
  for (const [index, child] of children.entries()) {
27337
27356
  if (child.flags & 2) offset--;
27338
27357
  if (child.flags & 4 && child.template != null) {
27358
+ if (child.anchor !== void 0) {
27359
+ const elementIndex = index + offset;
27360
+ const variable = `n${child.anchor}`;
27361
+ pushBlock(NEWLINE, `const ${variable} = `, ...genAccessPath(context, from, elementIndex, prev));
27362
+ prev = [
27363
+ variable,
27364
+ elementIndex,
27365
+ false
27366
+ ];
27367
+ }
27339
27368
  flushBeforeDynamic && flushBeforeDynamic(child, push);
27340
27369
  push(...genSelf(child, context, flushBeforeDynamic));
27341
27370
  continue;
@@ -27347,9 +27376,8 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
27347
27376
  continue;
27348
27377
  }
27349
27378
  const elementIndex = index + offset;
27350
- const logicalIndex = child.logicalIndex !== void 0 ? String(child.logicalIndex) : void 0;
27351
27379
  const inlinePlaceholder = id === void 0 && canInlinePlaceholder(child) && child.template == null && child.operation === void 0 && !(child.flags & 6);
27352
- const accessPath = genAccessPath(context, from, child, elementIndex, logicalIndex, prev);
27380
+ const accessPath = genAccessPath(context, from, elementIndex, prev);
27353
27381
  if (inlinePlaceholder) {
27354
27382
  if (prev && prev[2]) {
27355
27383
  push(...genChildren(child, context, pushBlock, [
@@ -27397,11 +27425,14 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
27397
27425
  * Build one DOM lookup path while preserving the fast sibling walk:
27398
27426
  * adjacent nodes use _next(prev), otherwise fall back to _nthChild(parent).
27399
27427
  */
27400
- function genAccessPath({ helper }, from, child, elementIndex, logicalIndex, prev) {
27401
- if (prev) return elementIndex - prev[1] === 1 ? genCall(helper("next"), prev[0], logicalIndex) : genNthChild(helper("nthChild"), from, elementIndex, logicalIndex);
27402
- if (elementIndex === 0) return genCall(helper("child"), from, child.logicalIndex !== 0 ? logicalIndex : void 0);
27403
- const firstChild = genCall(helper("child"), from);
27404
- return elementIndex === 1 ? genCall(helper("next"), firstChild, logicalIndex) : genNthChild(helper("nthChild"), from, elementIndex, logicalIndex);
27428
+ function genAccessPath({ helper }, from, elementIndex, prev) {
27429
+ if (prev) return elementIndex - prev[1] === 1 ? genCall(helper("next"), prev[0]) : genCall(helper("nthChild"), from, String(elementIndex));
27430
+ if (elementIndex === 0) return genCall(helper("child"), from);
27431
+ if (elementIndex === 1) {
27432
+ const firstChild = genCall(helper("child"), from);
27433
+ return genCall(helper("next"), firstChild);
27434
+ }
27435
+ return genCall(helper("nthChild"), from, String(elementIndex));
27405
27436
  }
27406
27437
  /**
27407
27438
  * Only inline a placeholder when materializing it would not save a parent
@@ -27414,13 +27445,15 @@ function canInlinePlaceholder(dynamic) {
27414
27445
  /**
27415
27446
  * A following access can reuse the current placeholder cursor only when it is
27416
27447
  * the next DOM sibling. Gapped siblings need _nthChild(parent, index) instead.
27448
+ * Kept in lockstep with genChildren's traversal rules.
27417
27449
  */
27418
27450
  function hasAdjacentFollowingAccessChild(children, index, elementIndex, offset) {
27419
27451
  let futureOffset = offset;
27420
27452
  for (let i = index + 1; i < children.length; i++) {
27421
27453
  const child = children[i];
27422
27454
  if (child.flags & 2) futureOffset--;
27423
- if (!(child.flags & 4 && child.template != null) && (!!(child.flags & 1) || child.hasDynamicChild)) return i + futureOffset - elementIndex === 1;
27455
+ if (child.flags & 4 && child.anchor === void 0) continue;
27456
+ if (!!(child.flags & 1) || child.hasDynamicChild) return i + futureOffset - elementIndex === 1;
27424
27457
  }
27425
27458
  return false;
27426
27459
  }
@@ -27435,7 +27468,7 @@ function countParentAccessUsages(dynamic) {
27435
27468
  let prev;
27436
27469
  for (const [index, child] of dynamic.children.entries()) {
27437
27470
  if (child.flags & 2) offset--;
27438
- if (child.flags & 4 && child.template != null) continue;
27471
+ if (child.flags & 4 && child.template != null && child.anchor === void 0) continue;
27439
27472
  const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
27440
27473
  if (id === void 0 && !child.hasDynamicChild) continue;
27441
27474
  const elementIndex = index + offset;
@@ -27456,10 +27489,6 @@ function countParentAccessUsages(dynamic) {
27456
27489
  }
27457
27490
  return usages;
27458
27491
  }
27459
- function genNthChild(nthChild, from, elementIndex, logicalIndex) {
27460
- const index = String(elementIndex);
27461
- return genCall(nthChild, from, index, logicalIndex === index ? void 0 : logicalIndex);
27462
- }
27463
27492
  //#endregion
27464
27493
  //#region packages/compiler-vapor/src/generators/block.ts
27465
27494
  function genBlock(oper, context, args = [], root) {
@@ -27477,6 +27506,7 @@ function genBlock(oper, context, args = [], root) {
27477
27506
  function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffectIndexes) {
27478
27507
  const [frag, push] = buildCodeFragment();
27479
27508
  const { dynamic, effect, operation, returns } = block;
27509
+ const modelOperations = operation.filter(isVModelOperation);
27480
27510
  const resetBlock = context.enterBlock(block);
27481
27511
  const singleUseAssetComponentNames = root ? collectSingleUseAssetComponents(block) : void 0;
27482
27512
  const prevSingleUseAssetComponentNames = context.singleUseAssetComponentNames;
@@ -27495,7 +27525,8 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
27495
27525
  let effectIndex = 0;
27496
27526
  const flushPendingOperations = (operationEnd, effectEnd, push) => {
27497
27527
  while (operationIndex < operationEnd) {
27498
- push(...genOperationWithInsertionState(operation[operationIndex], context));
27528
+ const oper = operation[operationIndex];
27529
+ if (!isVModelOperation(oper)) push(...genOperationWithInsertionState(oper, context));
27499
27530
  operationIndex++;
27500
27531
  }
27501
27532
  if (effectIndex < effectEnd) {
@@ -27512,9 +27543,10 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
27512
27543
  push(...genSelf(child, context, flushBeforeDynamic));
27513
27544
  }
27514
27545
  for (const child of dynamic.children) if (!child.hasDynamicChild) push(...genChildren(child, context, push, `n${child.id}`, flushBeforeDynamic));
27515
- if (operationIndex < operation.length) push(...genOperations(operation.slice(operationIndex), context));
27546
+ if (operationIndex < operation.length) push(...genOperations(operation.slice(operationIndex).filter((oper) => !isVModelOperation(oper)), context));
27516
27547
  if (effectIndex < effect.length) push(...genEffectRange(effectIndex, effect.length, genEffectsExtraFrag));
27517
27548
  else if (genEffectsExtraFrag) push(...genEffects([], context, genEffectsExtraFrag));
27549
+ if (modelOperations.length) push(...genOperations(modelOperations, context));
27518
27550
  push(NEWLINE, `return `);
27519
27551
  const returnNodes = returns.map((n) => `n${n}`);
27520
27552
  push(...returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "[]"]);
@@ -27532,27 +27564,48 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
27532
27564
  for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
27533
27565
  }
27534
27566
  }
27535
- function markSlotRootOperations(block) {
27567
+ function isVModelOperation(oper) {
27568
+ return oper.type === 13 && oper.builtin === true && oper.name === "model";
27569
+ }
27570
+ function markSlotRootOperations(block, context, sharedFallback = false) {
27571
+ if (hasStableSlotRoot(block, context)) return;
27572
+ sharedFallback = sharedFallback || hasMultipleDynamicSlotRoots(block);
27536
27573
  for (let i = 0; i < block.returns.length; i++) {
27537
27574
  const child = findReturnedDynamic$1(block, block.returns[i]);
27538
27575
  const operation = child && child.operation;
27539
27576
  if (!operation) continue;
27540
- if (operation.type === 15) markSlotRootIf(operation);
27541
- else if (operation.type === 16) markSlotRootFor(operation);
27542
- else if (operation.type === 12) markSlotRootComponent(operation);
27577
+ if (operation.type === 14) markSlotRootIf(operation, context, sharedFallback);
27578
+ else if (operation.type === 15) markSlotRootFor(operation, context);
27579
+ else if (operation.type === 16) {
27580
+ operation.slotRoot = true;
27581
+ markSlotRootOperations(operation.block, context, sharedFallback);
27582
+ } else if (operation.type === 11) markSlotRootComponent(operation);
27583
+ else if (operation.type === 12) {
27584
+ if (!(operation.flags & 2)) operation.flags |= 4;
27585
+ if (sharedFallback) operation.flags |= 16;
27586
+ else operation.flags |= 32;
27587
+ }
27543
27588
  }
27544
27589
  }
27545
- function markSlotRootIf(operation) {
27590
+ function markSlotRootIf(operation, context, sharedFallback) {
27546
27591
  if (!operation.once) operation.slotRoot = true;
27547
- markSlotRootOperations(operation.positive);
27592
+ markSlotRootOperations(operation.positive, context, sharedFallback);
27548
27593
  const negative = operation.negative;
27549
27594
  if (!negative) return;
27550
- if (negative.type === 15) markSlotRootIf(negative);
27551
- else markSlotRootOperations(negative);
27595
+ if (negative.type === 14) markSlotRootIf(negative, context, sharedFallback);
27596
+ else markSlotRootOperations(negative, context, sharedFallback);
27552
27597
  }
27553
- function markSlotRootFor(operation) {
27598
+ function markSlotRootFor(operation, context) {
27554
27599
  if (!operation.once) operation.slotRoot = true;
27555
- markSlotRootOperations(operation.render);
27600
+ markSlotRootOperations(operation.render, context, true);
27601
+ }
27602
+ function hasMultipleDynamicSlotRoots(block) {
27603
+ let count = 0;
27604
+ for (let i = 0; i < block.returns.length; i++) {
27605
+ const child = findReturnedDynamic$1(block, block.returns[i]);
27606
+ if (child && child.operation && ++count > 1) return true;
27607
+ }
27608
+ return false;
27556
27609
  }
27557
27610
  function markSlotRootComponent(operation) {
27558
27611
  if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
@@ -27563,6 +27616,40 @@ function findReturnedDynamic$1(block, id) {
27563
27616
  if (child.id === id) return child;
27564
27617
  }
27565
27618
  }
27619
+ const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
27620
+ function hasStableSlotRoot(block, context) {
27621
+ let hasValidRoot = false;
27622
+ for (let i = 0; i < block.returns.length; i++) {
27623
+ const id = block.returns[i];
27624
+ const child = findReturnedDynamic$1(block, id);
27625
+ const operation = child && child.operation;
27626
+ if (!operation) {
27627
+ if (child && isStableTemplateSlotRoot(child, context)) hasValidRoot = true;
27628
+ continue;
27629
+ }
27630
+ switch (operation.type) {
27631
+ case 11:
27632
+ if (!operation.dynamic || operation.dynamic.isStatic) {
27633
+ hasValidRoot = true;
27634
+ continue;
27635
+ }
27636
+ continue;
27637
+ case 16:
27638
+ if (hasStableSlotRoot(operation.block, context)) {
27639
+ hasValidRoot = true;
27640
+ continue;
27641
+ }
27642
+ continue;
27643
+ default: continue;
27644
+ }
27645
+ }
27646
+ return hasValidRoot;
27647
+ }
27648
+ function isStableTemplateSlotRoot(child, context) {
27649
+ if (child.template == null) return false;
27650
+ const content = context.ir.template.entries[child.template].content;
27651
+ return content !== "" && !commentOnlyTemplateRE.test(content.trim());
27652
+ }
27566
27653
  function collectSingleUseAssetComponents(block) {
27567
27654
  const usageMap = /* @__PURE__ */ new Map();
27568
27655
  const seenOperations = /* @__PURE__ */ new Set();
@@ -27582,7 +27669,7 @@ function collectSingleUseAssetComponents(block) {
27582
27669
  function visitOperation(operation, rootCandidate) {
27583
27670
  if (seenOperations.has(operation)) return;
27584
27671
  seenOperations.add(operation);
27585
- if (operation.type === 12) {
27672
+ if (operation.type === 11) {
27586
27673
  if (operation.asset) {
27587
27674
  const usage = usageMap.get(operation.tag) || {
27588
27675
  count: 0,
@@ -27596,18 +27683,18 @@ function collectSingleUseAssetComponents(block) {
27596
27683
  return;
27597
27684
  }
27598
27685
  switch (operation.type) {
27599
- case 15:
27686
+ case 14:
27600
27687
  visitBlock(operation.positive, false);
27601
- if (operation.negative) if (operation.negative.type === 15) visitOperation(operation.negative, false);
27688
+ if (operation.negative) if (operation.negative.type === 14) visitOperation(operation.negative, false);
27602
27689
  else visitBlock(operation.negative, false);
27603
27690
  break;
27604
- case 16:
27691
+ case 15:
27605
27692
  visitBlock(operation.render, false);
27606
27693
  break;
27607
- case 17:
27694
+ case 16:
27608
27695
  visitBlock(operation.block, false);
27609
27696
  break;
27610
- case 13:
27697
+ case 12:
27611
27698
  if (operation.fallback) visitBlock(operation.fallback, false);
27612
27699
  break;
27613
27700
  }
@@ -27881,11 +27968,14 @@ const transformVHtml = (dir, node, context) => {
27881
27968
  exp = EMPTY_EXPRESSION;
27882
27969
  }
27883
27970
  ignoreVHtmlChildren(node, context, "template");
27971
+ if (node.tagType === 1) return {
27972
+ key: createSimpleExpression("innerHTML", true, loc),
27973
+ value: exp
27974
+ };
27884
27975
  context.registerEffect([exp], {
27885
27976
  type: 8,
27886
27977
  element: context.reference(),
27887
- value: exp,
27888
- isComponent: node.tagType === 1
27978
+ value: exp
27889
27979
  });
27890
27980
  };
27891
27981
  //#endregion
@@ -27979,7 +28069,7 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
27979
28069
  context.dynamic.flags |= 6;
27980
28070
  const id = context.reference();
27981
28071
  context.dynamic.operation = _objectSpread2(_objectSpread2({
27982
- type: 12,
28072
+ type: 11,
27983
28073
  id
27984
28074
  }, context.effectBoundary()), {}, {
27985
28075
  tag,
@@ -28025,27 +28115,22 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
28025
28115
  tag
28026
28116
  }, getEffectIndex);
28027
28117
  } else {
28028
- let prevWasQuoted = false;
28029
28118
  const appendTemplateProp = (key, value = "", generated = false) => {
28030
- if (!prevWasQuoted) template += ` `;
28031
- template += key;
28119
+ template += ` ${key}`;
28032
28120
  if (value) {
28033
28121
  const escapedValue = generated ? escapeGeneratedAttrValue(value) : value.replace(/"/g, "&quot;");
28034
- template += (prevWasQuoted = NEEDS_QUOTES_RE.test(value)) ? `="${escapedValue}"` : `=${escapedValue}`;
28035
- } else prevWasQuoted = false;
28122
+ template += NEEDS_QUOTES_RE.test(value) ? `="${escapedValue}"` : `=${escapedValue}`;
28123
+ }
28036
28124
  };
28037
28125
  for (const prop of propsResult[1]) {
28038
28126
  const { key, values } = prop;
28039
28127
  const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
28040
28128
  let foldedValue;
28041
- if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) {
28042
- if (!prevWasQuoted) template += ` `;
28043
- template += `${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
28044
- prevWasQuoted = true;
28045
- } else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
28129
+ if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) template += ` ${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
28130
+ else if (canStringifyAttrName && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content)) {
28046
28131
  const value = values[0].content === "''" ? "" : values[0].content;
28047
28132
  appendTemplateProp(key.content, value);
28048
- } else if (canStringifyAttrName && !prop.modifier && isBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(values)) != null) {
28133
+ } else if (canStringifyAttrName && !prop.modifier && (isBooleanAttr(key.content) || key.content === "hidden") && (foldedValue = foldBooleanAttrValue(key.content, values)) != null) {
28049
28134
  if (foldedValue) appendTemplateProp(key.content);
28050
28135
  } else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
28051
28136
  if (foldedValue) appendTemplateProp(key.content, foldedValue, true);
@@ -28070,11 +28155,12 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
28070
28155
  function escapeGeneratedAttrValue(value) {
28071
28156
  return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
28072
28157
  }
28073
- function foldBooleanAttrValue(values) {
28158
+ function foldBooleanAttrValue(key, values) {
28074
28159
  if (values.length !== 1) return;
28075
28160
  const evaluated = evaluateConstantExpression(values[0]);
28076
28161
  if (!evaluated) return;
28077
28162
  const value = evaluated.value;
28163
+ if (key === "hidden" && typeof value === "number") return includeBooleanAttr(value);
28078
28164
  if (value === true || value === false || value == null) return includeBooleanAttr(value);
28079
28165
  }
28080
28166
  function foldStyleValues(values) {
@@ -28436,7 +28522,7 @@ function transformProp(prop, node, context) {
28436
28522
  if (fromSetup) name = fromSetup;
28437
28523
  else context.directive.add(name);
28438
28524
  context.registerOperation({
28439
- type: 14,
28525
+ type: 13,
28440
28526
  element: context.reference(),
28441
28527
  dir: prop,
28442
28528
  name,
@@ -28517,49 +28603,33 @@ const transformChildren = (node, context) => {
28517
28603
  if (!isFragment) processDynamicChildren(context);
28518
28604
  };
28519
28605
  function processDynamicChildren(context) {
28520
- let prevDynamics = [];
28521
- let staticCount = 0;
28522
28606
  const children = context.dynamic.children;
28523
- let logicalIndex = 0;
28524
- for (const [index, child] of children.entries()) {
28525
- if (child.flags & 4) {
28526
- child.logicalIndex = logicalIndex;
28527
- prevDynamics.push(child);
28528
- logicalIndex++;
28529
- }
28530
- if (!(child.flags & 2)) {
28531
- child.logicalIndex = logicalIndex;
28532
- if (prevDynamics.length) {
28533
- if (staticCount) {
28534
- context.childrenTemplate[index - prevDynamics.length] = `<!>`;
28535
- prevDynamics[0].flags -= 2;
28536
- const anchor = prevDynamics[0].anchor = context.increaseId();
28537
- registerInsertion(prevDynamics, context, anchor);
28538
- } else registerInsertion(prevDynamics, context, -1);
28539
- prevDynamics = [];
28540
- }
28541
- staticCount++;
28542
- logicalIndex++;
28543
- }
28544
- }
28545
- if (prevDynamics.length) registerInsertion(prevDynamics, context, prevDynamics[0].logicalIndex, true);
28546
- }
28547
- function registerInsertion(dynamics, context, anchor, append) {
28548
- for (const child of dynamics) {
28549
- const logicalIndex = child.logicalIndex;
28550
- if (child.template != null) context.registerOperation({
28607
+ let lastTemplateIndex = -1;
28608
+ for (let i = children.length - 1; i >= 0; i--) if (!(children[i].flags & 2)) {
28609
+ lastTemplateIndex = i;
28610
+ break;
28611
+ }
28612
+ let unitIndex = 0;
28613
+ for (const [index, child] of children.entries()) if (child.flags & 4) {
28614
+ let anchor;
28615
+ if (index < lastTemplateIndex) {
28616
+ context.childrenTemplate[index] = `<!>`;
28617
+ child.flags = child.flags - 2 | 1;
28618
+ anchor = child.anchor = context.increaseId();
28619
+ }
28620
+ if (child.template != null) child.operation = {
28551
28621
  type: 10,
28552
- elements: dynamics.map((child) => child.id),
28622
+ elements: [child.id],
28553
28623
  parent: context.reference(),
28554
- anchor: append ? void 0 : anchor
28555
- });
28624
+ anchor
28625
+ };
28556
28626
  else if (child.operation && isBlockOperation(child.operation)) {
28557
28627
  child.operation.parent = context.reference();
28558
- child.operation.anchor = anchor;
28559
- child.operation.logicalIndex = logicalIndex;
28560
- child.operation.append = append;
28628
+ if (anchor !== void 0) child.operation.anchor = anchor;
28629
+ else child.operation.appendIndex = unitIndex;
28561
28630
  }
28562
- }
28631
+ unitIndex++;
28632
+ } else if (!(child.flags & 2)) unitIndex++;
28563
28633
  }
28564
28634
  //#endregion
28565
28635
  //#region packages/compiler-vapor/src/transforms/vOnce.ts
@@ -28653,7 +28723,7 @@ function processTextContainer(children, context) {
28653
28723
  else {
28654
28724
  context.childrenTemplate = [" "];
28655
28725
  context.registerOperation({
28656
- type: 18,
28726
+ type: 17,
28657
28727
  parent: context.reference()
28658
28728
  });
28659
28729
  context.registerEffect(values, {
@@ -28709,6 +28779,7 @@ function isTextLike(node) {
28709
28779
  }
28710
28780
  //#endregion
28711
28781
  //#region packages/compiler-vapor/src/transforms/vText.ts
28782
+ const isRawTextContainer = /* @__PURE__ */ makeMap("iframe,noembed,noframes,noscript,script,style,xmp");
28712
28783
  const transformVText = (dir, node, context) => {
28713
28784
  let { exp, loc } = dir;
28714
28785
  if (!exp) {
@@ -28721,18 +28792,22 @@ const transformVText = (dir, node, context) => {
28721
28792
  for (const child of node.children) markNonTemplate(child, context);
28722
28793
  }
28723
28794
  if (isVoidTag(context.node.tag)) return;
28795
+ if (node.tagType === 1) return {
28796
+ key: createSimpleExpression("textContent", true),
28797
+ value: exp,
28798
+ toDisplayString: !isConstantVTextExpression(exp, context.options.bindingMetadata)
28799
+ };
28724
28800
  const literal = getLiteralExpressionValue(exp);
28725
28801
  const useCreateElement = shouldUseCreateElement(context.node, context);
28726
- if (literal != null) if (useCreateElement) {
28802
+ if (literal != null) if (useCreateElement || isRawTextContainer(node.tag)) {
28727
28803
  const id = registerSyntheticTextChild(context, "", [exp]);
28728
28804
  context.registerOperation({
28729
28805
  type: 10,
28730
28806
  elements: [id],
28731
28807
  parent: context.reference()
28732
28808
  });
28733
- } else context.childrenTemplate = [String(literal)];
28809
+ } else context.childrenTemplate = [escapeHtml(literal)];
28734
28810
  else {
28735
- const isComponent = node.tagType === 1;
28736
28811
  let id;
28737
28812
  if (useCreateElement) {
28738
28813
  id = registerSyntheticTextChild(context, "");
@@ -28741,10 +28816,10 @@ const transformVText = (dir, node, context) => {
28741
28816
  elements: [id],
28742
28817
  parent: context.reference()
28743
28818
  });
28744
- } else if (!isComponent) {
28819
+ } else {
28745
28820
  context.childrenTemplate = [" "];
28746
28821
  context.registerOperation({
28747
- type: 18,
28822
+ type: 17,
28748
28823
  parent: context.reference()
28749
28824
  });
28750
28825
  }
@@ -28752,11 +28827,24 @@ const transformVText = (dir, node, context) => {
28752
28827
  type: 5,
28753
28828
  element: useCreateElement ? id : context.reference(),
28754
28829
  values: [exp],
28755
- generated: !useCreateElement,
28756
- isComponent
28830
+ generated: !useCreateElement
28757
28831
  });
28758
28832
  }
28759
28833
  };
28834
+ function isConstantVTextExpression(exp, bindings) {
28835
+ if (isConstantExpression(exp)) return true;
28836
+ if (exp.ast === null) {
28837
+ const type = bindings[exp.content];
28838
+ return type === "setup-const" || type === "literal-const";
28839
+ }
28840
+ if (!exp.ast) return false;
28841
+ let isConstant = true;
28842
+ walkIdentifiers(exp.ast, (id, parent, _parentStack, isReferenced) => {
28843
+ if (parent && isStaticPropertyKey(id, parent)) return;
28844
+ if (isReferenced && !isGloballyAllowed(id.name) && id.name !== "require" || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "NewExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression") isConstant = false;
28845
+ }, true);
28846
+ return isConstant;
28847
+ }
28760
28848
  //#endregion
28761
28849
  //#region packages/compiler-vapor/src/transforms/vOn.ts
28762
28850
  const delegatedEvents = /* @__PURE__ */ makeMap("beforeinput,click,dblclick,contextmenu,focusin,focusout,input,keydown,keyup,mousedown,mousemove,mouseout,mouseover,mouseup,pointerdown,pointermove,pointerout,pointerover,pointerup,touchend,touchmove,touchstart");
@@ -28856,7 +28944,7 @@ const transformVShow = (dir, node, context) => {
28856
28944
  return;
28857
28945
  }
28858
28946
  context.registerOperation({
28859
- type: 14,
28947
+ type: 13,
28860
28948
  element: context.reference(),
28861
28949
  dir,
28862
28950
  name: "show",
@@ -28940,7 +29028,7 @@ const transformVModel = (dir, node, context) => {
28940
29028
  else checkDuplicatedValue();
28941
29029
  else context.options.onError(createDOMCompilerError(58, dir.loc));
28942
29030
  if (modelType) context.registerOperation({
28943
- type: 14,
29031
+ type: 13,
28944
29032
  element: context.reference(),
28945
29033
  dir,
28946
29034
  name: "model",
@@ -29005,7 +29093,7 @@ function processIf(node, dir, context) {
29005
29093
  return () => {
29006
29094
  onExit();
29007
29095
  context.dynamic.operation = _objectSpread2(_objectSpread2({
29008
- type: 15,
29096
+ type: 14,
29009
29097
  id
29010
29098
  }, context.effectBoundary()), {}, {
29011
29099
  blockShape: encodeIfBlockShape(branch, forceMultiRoot, void 0, allowNoScope),
@@ -29021,16 +29109,16 @@ function processIf(node, dir, context) {
29021
29109
  let lastIfNode;
29022
29110
  if (siblings) {
29023
29111
  let i = siblings.length;
29024
- while (i--) if (siblings[i].operation && siblings[i].operation.type === 15) {
29112
+ while (i--) if (siblings[i].operation && siblings[i].operation.type === 14) {
29025
29113
  lastIfNode = siblings[i].operation;
29026
29114
  break;
29027
29115
  }
29028
29116
  }
29029
- if (!siblingIf || !lastIfNode || lastIfNode.type !== 15) {
29117
+ if (!siblingIf || !lastIfNode || lastIfNode.type !== 14) {
29030
29118
  context.options.onError(createCompilerError(30, node.loc));
29031
29119
  return;
29032
29120
  }
29033
- while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
29121
+ while (lastIfNode.negative && lastIfNode.negative.type === 14) lastIfNode = lastIfNode.negative;
29034
29122
  if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
29035
29123
  const comments = context.comment;
29036
29124
  if (comments.length) {
@@ -29043,7 +29131,7 @@ function processIf(node, dir, context) {
29043
29131
  const [branch, onExit] = createIfBranch(node, context);
29044
29132
  if (dir.name === "else") lastIfNode.negative = branch;
29045
29133
  else lastIfNode.negative = {
29046
- type: 15,
29134
+ type: 14,
29047
29135
  id: -1,
29048
29136
  condition: dir.exp,
29049
29137
  positive: branch,
@@ -29053,7 +29141,7 @@ function processIf(node, dir, context) {
29053
29141
  };
29054
29142
  return () => {
29055
29143
  onExit();
29056
- if (lastIfNode.negative.type === 15) lastIfNode.negative.blockShape = encodeIfBlockShape(lastIfNode.negative.positive, forceMultiRoot, void 0, allowNoScope);
29144
+ if (lastIfNode.negative.type === 14) lastIfNode.negative.blockShape = encodeIfBlockShape(lastIfNode.negative.positive, forceMultiRoot, void 0, allowNoScope);
29057
29145
  lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot, lastIfNode.negative, allowNoScope);
29058
29146
  };
29059
29147
  }
@@ -29072,12 +29160,12 @@ function createIfBranch(node, context) {
29072
29160
  function encodeIfBlockShape(positive, forceMultiRoot = false, negative, allowNoScope = true) {
29073
29161
  if (forceMultiRoot) return 10;
29074
29162
  const positiveNoScope = allowNoScope && canSkipIfBranchScope(positive);
29075
- const negativeNoScope = allowNoScope && negative && negative.type !== 15 && canSkipIfBranchScope(negative);
29163
+ const negativeNoScope = allowNoScope && negative && negative.type !== 14 && canSkipIfBranchScope(negative);
29076
29164
  return getBlockShape(positive) | getNegativeIfBranchShape(negative) << 2 | (positiveNoScope ? 32 : 0) | (negativeNoScope ? 64 : 0);
29077
29165
  }
29078
29166
  function getNegativeIfBranchShape(negative) {
29079
29167
  if (!negative) return 0;
29080
- return negative.type === 15 ? 1 : getBlockShape(negative);
29168
+ return negative.type === 14 ? 1 : getBlockShape(negative);
29081
29169
  }
29082
29170
  function canSkipIfBranchScope(block) {
29083
29171
  if (block.effect.length || block.operation.length) return false;
@@ -29134,7 +29222,7 @@ function processFor(node, dir, context) {
29134
29222
  const { parent } = context;
29135
29223
  const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
29136
29224
  context.dynamic.operation = _objectSpread2(_objectSpread2({
29137
- type: 16,
29225
+ type: 15,
29138
29226
  id
29139
29227
  }, context.effectBoundary()), {}, {
29140
29228
  source,
@@ -29182,7 +29270,7 @@ const transformSlotOutlet = (node, context) => {
29182
29270
  if (slotProps.length) {
29183
29271
  const [isDynamic, props] = buildProps(extend({}, node, { props: slotProps }), context, true);
29184
29272
  irProps = isDynamic ? props : [props];
29185
- const runtimeDirective = context.block.operation.find((oper) => oper.type === 14 && oper.element === id);
29273
+ const runtimeDirective = context.block.operation.find((oper) => oper.type === 13 && oper.element === id);
29186
29274
  if (runtimeDirective) context.options.onError(createCompilerError(36, runtimeDirective.dir.loc));
29187
29275
  }
29188
29276
  return () => {
@@ -29191,7 +29279,7 @@ const transformSlotOutlet = (node, context) => {
29191
29279
  if (context.options.scopeId && !context.options.slotted) flags |= 1;
29192
29280
  if (context.inVOnce) flags |= 2;
29193
29281
  context.dynamic.operation = _objectSpread2(_objectSpread2({
29194
- type: 13,
29282
+ type: 12,
29195
29283
  id
29196
29284
  }, context.effectBoundary()), {}, {
29197
29285
  name: slotName,
@@ -29391,7 +29479,7 @@ const transformKey = (node, context) => {
29391
29479
  return () => {
29392
29480
  exitBlock();
29393
29481
  context.dynamic.operation = _objectSpread2(_objectSpread2({
29394
- type: 17,
29482
+ type: 16,
29395
29483
  id
29396
29484
  }, context.effectBoundary()), {}, {
29397
29485
  value,
@@ -29759,6 +29847,7 @@ const ssrTransformElement = (node, context) => {
29759
29847
  else {
29760
29848
  attrName = node.tag.indexOf("-") > 0 ? attrName : propsToAttrMap[attrName] || attrName.toLowerCase();
29761
29849
  if (isBooleanAttr(attrName)) openTag.push(createConditionalExpression(createCallExpression(context.helper(SSR_INCLUDE_BOOLEAN_ATTR), [value]), createSimpleExpression(" " + attrName, true), createSimpleExpression("", true), false));
29850
+ else if (attrName === "hidden") openTag.push(createCallExpression(context.helper(SSR_RENDER_DYNAMIC_ATTR), [key, value]));
29762
29851
  else if (isSSRSafeAttrName(attrName)) openTag.push(createCallExpression(context.helper(SSR_RENDER_ATTR), [key, value]));
29763
29852
  else context.onError(createSSRCompilerError(65, key.loc));
29764
29853
  }
@@ -30411,10 +30500,12 @@ function doCompileTemplate({ filename, id, scoped, slotted, inMap, source, ast:
30411
30500
  const defaultCompiler = ssr ? src_exports : vapor ? src_exports$1 : src_exports$2;
30412
30501
  compiler = compiler || defaultCompiler;
30413
30502
  if (compiler !== defaultCompiler) inAST = void 0;
30414
- if (inAST === null || inAST === void 0 ? void 0 : inAST.transformed) inAST = createRoot((ssr ? src_exports$2 : compiler).parse(inAST.source, _objectSpread2(_objectSpread2({ prefixIdentifiers: true }, compilerOptions), {}, {
30415
- parseMode: "sfc",
30503
+ inAST = resolveTemplateAST(inAST, {
30504
+ compiler,
30505
+ compilerOptions,
30506
+ ssr,
30416
30507
  onError: (e) => errors.push(e)
30417
- })).children.find((node) => node.type === 1 && node.tag === "template").children, inAST.source);
30508
+ });
30418
30509
  let { code, ast, preamble, map, helpers } = compiler.compile(inAST || source, _objectSpread2(_objectSpread2({
30419
30510
  mode: "module",
30420
30511
  prefixIdentifiers: true,
@@ -41423,7 +41514,13 @@ function resolveTypeReference(ctx, node, scope, name, onlyExported = false) {
41423
41514
  return node._resolvedReference;
41424
41515
  }
41425
41516
  const resolved = innerResolveTypeReference(ctx, scope || ctxToScope(ctx), name || getReferenceName(node), node, onlyExported);
41426
- return canCache ? node._resolvedReference = resolved : resolved;
41517
+ if (canCache) Object.defineProperty(node, "_resolvedReference", {
41518
+ value: resolved,
41519
+ writable: true,
41520
+ configurable: true,
41521
+ enumerable: false
41522
+ });
41523
+ return resolved;
41427
41524
  }
41428
41525
  function innerResolveTypeReference(ctx, scope, name, node, onlyExported) {
41429
41526
  if (typeof name === "string") if (scope.imports[name]) return resolveTypeFromImport(ctx, node, name, scope);
@@ -42645,7 +42742,7 @@ function compileScript(sfc, options) {
42645
42742
  }
42646
42743
  function registerUserImport(source, local, imported, isType, isFromSetup, needTemplateUsageCheck) {
42647
42744
  let isImportUsed = needTemplateUsageCheck;
42648
- if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) isImportUsed = isUsedInTemplate(local, sfc);
42745
+ if (needTemplateUsageCheck && ctx.isTS && sfc.template && !sfc.template.src && !sfc.template.lang) isImportUsed = isUsedInTemplate(local, sfc, options.templateOptions);
42649
42746
  ctx.userImports[local] = {
42650
42747
  isType,
42651
42748
  imported,
@@ -42848,7 +42945,7 @@ function compileScript(sfc, options) {
42848
42945
  for (const key in scriptBindings) ctx.bindingMetadata[key] = scriptBindings[key];
42849
42946
  for (const key in setupBindings) ctx.bindingMetadata[key] = setupBindings[key];
42850
42947
  if (sfc.template && !sfc.template.src && sfc.template.ast) {
42851
- const vModelIds = resolveTemplateVModelIdentifiers(sfc);
42948
+ const vModelIds = resolveTemplateVModelIdentifiers(sfc, options.templateOptions);
42852
42949
  if (vModelIds.size) {
42853
42950
  const toDemote = /* @__PURE__ */ new Set();
42854
42951
  for (const id of vModelIds) if (setupBindings[id] === "setup-reactive-const") toDemote.add(id);
@@ -43105,7 +43202,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
43105
43202
  //#endregion
43106
43203
  //#region packages/compiler-sfc/src/index.ts
43107
43204
  init_objectSpread2();
43108
- const version = "3.6.0-rc.2";
43205
+ const version = "3.6.0-rc.3";
43109
43206
  const parseCache = parseCache$1;
43110
43207
  const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
43111
43208
  const walk = walk$2;