@vue/compat 3.4.0-alpha.2 → 3.4.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue.cjs.js CHANGED
@@ -15,8 +15,8 @@ const EMPTY_ARR = Object.freeze([]) ;
15
15
  const NOOP = () => {
16
16
  };
17
17
  const NO = () => false;
18
- const onRE = /^on[^a-z]/;
19
- const isOn = (key) => onRE.test(key);
18
+ const isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // uppercase letter
19
+ (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
20
20
  const isModelListener = (key) => key.startsWith("onUpdate:");
21
21
  const extend = Object.assign;
22
22
  const remove = (arr, el) => {
@@ -128,7 +128,7 @@ const slotFlagsText = {
128
128
  [3]: "FORWARDED"
129
129
  };
130
130
 
131
- const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console";
131
+ const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error";
132
132
  const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
133
133
 
134
134
  const range = 2;
@@ -1572,6 +1572,18 @@ function propertyToRef(source, key, defaultValue) {
1572
1572
  return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1573
1573
  }
1574
1574
 
1575
+ const TrackOpTypes = {
1576
+ "GET": "get",
1577
+ "HAS": "has",
1578
+ "ITERATE": "iterate"
1579
+ };
1580
+ const TriggerOpTypes = {
1581
+ "SET": "set",
1582
+ "ADD": "add",
1583
+ "DELETE": "delete",
1584
+ "CLEAR": "clear"
1585
+ };
1586
+
1575
1587
  const stack$1 = [];
1576
1588
  function pushWarningContext(vnode) {
1577
1589
  stack$1.push(vnode);
@@ -1686,6 +1698,38 @@ function assertNumber(val, type) {
1686
1698
  }
1687
1699
  }
1688
1700
 
1701
+ const ErrorCodes = {
1702
+ "SETUP_FUNCTION": 0,
1703
+ "0": "SETUP_FUNCTION",
1704
+ "RENDER_FUNCTION": 1,
1705
+ "1": "RENDER_FUNCTION",
1706
+ "WATCH_GETTER": 2,
1707
+ "2": "WATCH_GETTER",
1708
+ "WATCH_CALLBACK": 3,
1709
+ "3": "WATCH_CALLBACK",
1710
+ "WATCH_CLEANUP": 4,
1711
+ "4": "WATCH_CLEANUP",
1712
+ "NATIVE_EVENT_HANDLER": 5,
1713
+ "5": "NATIVE_EVENT_HANDLER",
1714
+ "COMPONENT_EVENT_HANDLER": 6,
1715
+ "6": "COMPONENT_EVENT_HANDLER",
1716
+ "VNODE_HOOK": 7,
1717
+ "7": "VNODE_HOOK",
1718
+ "DIRECTIVE_HOOK": 8,
1719
+ "8": "DIRECTIVE_HOOK",
1720
+ "TRANSITION_HOOK": 9,
1721
+ "9": "TRANSITION_HOOK",
1722
+ "APP_ERROR_HANDLER": 10,
1723
+ "10": "APP_ERROR_HANDLER",
1724
+ "APP_WARN_HANDLER": 11,
1725
+ "11": "APP_WARN_HANDLER",
1726
+ "FUNCTION_REF": 12,
1727
+ "12": "FUNCTION_REF",
1728
+ "ASYNC_COMPONENT_LOADER": 13,
1729
+ "13": "ASYNC_COMPONENT_LOADER",
1730
+ "SCHEDULER": 14,
1731
+ "14": "SCHEDULER"
1732
+ };
1689
1733
  const ErrorTypeStrings$1 = {
1690
1734
  ["sp"]: "serverPrefetch hook",
1691
1735
  ["bc"]: "beforeCreate hook",
@@ -2168,6 +2212,50 @@ function devtoolsComponentEmit(component, event, params) {
2168
2212
  );
2169
2213
  }
2170
2214
 
2215
+ const DeprecationTypes$1 = {
2216
+ "GLOBAL_MOUNT": "GLOBAL_MOUNT",
2217
+ "GLOBAL_MOUNT_CONTAINER": "GLOBAL_MOUNT_CONTAINER",
2218
+ "GLOBAL_EXTEND": "GLOBAL_EXTEND",
2219
+ "GLOBAL_PROTOTYPE": "GLOBAL_PROTOTYPE",
2220
+ "GLOBAL_SET": "GLOBAL_SET",
2221
+ "GLOBAL_DELETE": "GLOBAL_DELETE",
2222
+ "GLOBAL_OBSERVABLE": "GLOBAL_OBSERVABLE",
2223
+ "GLOBAL_PRIVATE_UTIL": "GLOBAL_PRIVATE_UTIL",
2224
+ "CONFIG_SILENT": "CONFIG_SILENT",
2225
+ "CONFIG_DEVTOOLS": "CONFIG_DEVTOOLS",
2226
+ "CONFIG_KEY_CODES": "CONFIG_KEY_CODES",
2227
+ "CONFIG_PRODUCTION_TIP": "CONFIG_PRODUCTION_TIP",
2228
+ "CONFIG_IGNORED_ELEMENTS": "CONFIG_IGNORED_ELEMENTS",
2229
+ "CONFIG_WHITESPACE": "CONFIG_WHITESPACE",
2230
+ "CONFIG_OPTION_MERGE_STRATS": "CONFIG_OPTION_MERGE_STRATS",
2231
+ "INSTANCE_SET": "INSTANCE_SET",
2232
+ "INSTANCE_DELETE": "INSTANCE_DELETE",
2233
+ "INSTANCE_DESTROY": "INSTANCE_DESTROY",
2234
+ "INSTANCE_EVENT_EMITTER": "INSTANCE_EVENT_EMITTER",
2235
+ "INSTANCE_EVENT_HOOKS": "INSTANCE_EVENT_HOOKS",
2236
+ "INSTANCE_CHILDREN": "INSTANCE_CHILDREN",
2237
+ "INSTANCE_LISTENERS": "INSTANCE_LISTENERS",
2238
+ "INSTANCE_SCOPED_SLOTS": "INSTANCE_SCOPED_SLOTS",
2239
+ "INSTANCE_ATTRS_CLASS_STYLE": "INSTANCE_ATTRS_CLASS_STYLE",
2240
+ "OPTIONS_DATA_FN": "OPTIONS_DATA_FN",
2241
+ "OPTIONS_DATA_MERGE": "OPTIONS_DATA_MERGE",
2242
+ "OPTIONS_BEFORE_DESTROY": "OPTIONS_BEFORE_DESTROY",
2243
+ "OPTIONS_DESTROYED": "OPTIONS_DESTROYED",
2244
+ "WATCH_ARRAY": "WATCH_ARRAY",
2245
+ "PROPS_DEFAULT_THIS": "PROPS_DEFAULT_THIS",
2246
+ "V_ON_KEYCODE_MODIFIER": "V_ON_KEYCODE_MODIFIER",
2247
+ "CUSTOM_DIR": "CUSTOM_DIR",
2248
+ "ATTR_FALSE_VALUE": "ATTR_FALSE_VALUE",
2249
+ "ATTR_ENUMERATED_COERCION": "ATTR_ENUMERATED_COERCION",
2250
+ "TRANSITION_CLASSES": "TRANSITION_CLASSES",
2251
+ "TRANSITION_GROUP_ROOT": "TRANSITION_GROUP_ROOT",
2252
+ "COMPONENT_ASYNC": "COMPONENT_ASYNC",
2253
+ "COMPONENT_FUNCTIONAL": "COMPONENT_FUNCTIONAL",
2254
+ "COMPONENT_V_MODEL": "COMPONENT_V_MODEL",
2255
+ "RENDER_FUNCTION": "RENDER_FUNCTION",
2256
+ "FILTERS": "FILTERS",
2257
+ "PRIVATE_APIS": "PRIVATE_APIS"
2258
+ };
2171
2259
  const deprecationData$1 = {
2172
2260
  ["GLOBAL_MOUNT"]: {
2173
2261
  message: `The global app bootstrapping API has changed: vm.$mount() and the "el" option have been removed. Use createApp(RootComponent).mount() instead.`,
@@ -3482,7 +3570,12 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3482
3570
  if (delayEnter) {
3483
3571
  activeBranch.transition.afterLeave = () => {
3484
3572
  if (pendingId === suspense.pendingId) {
3485
- move(pendingBranch, container2, anchor2, 0);
3573
+ move(
3574
+ pendingBranch,
3575
+ container2,
3576
+ next(activeBranch),
3577
+ 0
3578
+ );
3486
3579
  queuePostFlushCb(effects);
3487
3580
  }
3488
3581
  };
@@ -3529,7 +3622,6 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3529
3622
  }
3530
3623
  const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;
3531
3624
  triggerEvent(vnode2, "onFallback");
3532
- const anchor2 = next(activeBranch);
3533
3625
  const mountFallback = () => {
3534
3626
  if (!suspense.isInFallback) {
3535
3627
  return;
@@ -3538,7 +3630,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
3538
3630
  null,
3539
3631
  fallbackVNode,
3540
3632
  container2,
3541
- anchor2,
3633
+ next(activeBranch),
3542
3634
  parentComponent2,
3543
3635
  null,
3544
3636
  // fallback tree will not have suspense context
@@ -6423,7 +6515,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6423
6515
  return vm;
6424
6516
  }
6425
6517
  }
6426
- Vue.version = `2.6.14-compat:${"3.4.0-alpha.2"}`;
6518
+ Vue.version = `2.6.14-compat:${"3.4.0-alpha.4"}`;
6427
6519
  Vue.config = singletonApp.config;
6428
6520
  Vue.use = (p, ...options) => {
6429
6521
  if (p && isFunction(p.install)) {
@@ -6824,18 +6916,6 @@ function createAppAPI(render, hydrate) {
6824
6916
  rootProps = null;
6825
6917
  }
6826
6918
  const context = createAppContext();
6827
- {
6828
- Object.defineProperty(context.config, "unwrapInjectedRef", {
6829
- get() {
6830
- return true;
6831
- },
6832
- set() {
6833
- warn(
6834
- `app.config.unwrapInjectedRef has been deprecated. 3.3 now always unwraps injected refs in Options API.`
6835
- );
6836
- }
6837
- });
6838
- }
6839
6919
  const installedPlugins = /* @__PURE__ */ new WeakSet();
6840
6920
  let isMounted = false;
6841
6921
  const app = context.app = {
@@ -10838,9 +10918,9 @@ function initCustomFormatter() {
10838
10918
  return;
10839
10919
  }
10840
10920
  const vueStyle = { style: "color:#3ba776" };
10841
- const numberStyle = { style: "color:#0b1bc9" };
10842
- const stringStyle = { style: "color:#b62e24" };
10843
- const keywordStyle = { style: "color:#9d288c" };
10921
+ const numberStyle = { style: "color:#1677ff" };
10922
+ const stringStyle = { style: "color:#f5222d" };
10923
+ const keywordStyle = { style: "color:#eb2f96" };
10844
10924
  const formatter = {
10845
10925
  header(obj) {
10846
10926
  if (!isObject(obj)) {
@@ -11034,7 +11114,7 @@ function isMemoSame(cached, memo) {
11034
11114
  return true;
11035
11115
  }
11036
11116
 
11037
- const version = "3.4.0-alpha.2";
11117
+ const version = "3.4.0-alpha.4";
11038
11118
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11039
11119
  const _ssrUtils = {
11040
11120
  createComponentInstance,
@@ -11054,6 +11134,7 @@ const _compatUtils = {
11054
11134
  softAssertCompatEnabled
11055
11135
  };
11056
11136
  const compatUtils = _compatUtils ;
11137
+ const DeprecationTypes = DeprecationTypes$1 ;
11057
11138
 
11058
11139
  const svgNS = "http://www.w3.org/2000/svg";
11059
11140
  const doc = typeof document !== "undefined" ? document : null;
@@ -11749,7 +11830,8 @@ function patchStopImmediatePropagation(e, value) {
11749
11830
  }
11750
11831
  }
11751
11832
 
11752
- const nativeOnRE = /^on[a-z]/;
11833
+ const isNativeOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && // lowercase letter
11834
+ key.charCodeAt(2) > 96 && key.charCodeAt(2) < 123;
11753
11835
  const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => {
11754
11836
  if (key === "class") {
11755
11837
  patchClass(el, nextValue, isSVG);
@@ -11783,7 +11865,7 @@ function shouldSetAsProp(el, key, value, isSVG) {
11783
11865
  if (key === "innerHTML" || key === "textContent") {
11784
11866
  return true;
11785
11867
  }
11786
- if (key in el && nativeOnRE.test(key) && isFunction(value)) {
11868
+ if (key in el && isNativeOn(key) && isFunction(value)) {
11787
11869
  return true;
11788
11870
  }
11789
11871
  return false;
@@ -11800,7 +11882,11 @@ function shouldSetAsProp(el, key, value, isSVG) {
11800
11882
  if (key === "type" && el.tagName === "TEXTAREA") {
11801
11883
  return false;
11802
11884
  }
11803
- if (nativeOnRE.test(key) && isString(value)) {
11885
+ if (key === "width" || key === "height") {
11886
+ const tag = el.tagName;
11887
+ return !(tag === "IMG" || tag === "VIDEO" || tag === "CANVAS" || tag === "SOURCE");
11888
+ }
11889
+ if (isNativeOn(key) && isString(value)) {
11804
11890
  return false;
11805
11891
  }
11806
11892
  return key in el;
@@ -12469,14 +12555,14 @@ const modifierGuards = {
12469
12555
  exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m))
12470
12556
  };
12471
12557
  const withModifiers = (fn, modifiers) => {
12472
- return (event, ...args) => {
12558
+ return fn._withMods || (fn._withMods = (event, ...args) => {
12473
12559
  for (let i = 0; i < modifiers.length; i++) {
12474
12560
  const guard = modifierGuards[modifiers[i]];
12475
12561
  if (guard && guard(event, modifiers))
12476
12562
  return;
12477
12563
  }
12478
12564
  return fn(event, ...args);
12479
- };
12565
+ });
12480
12566
  };
12481
12567
  const keyNames = {
12482
12568
  esc: "escape",
@@ -12504,7 +12590,7 @@ const withKeys = (fn, modifiers) => {
12504
12590
  );
12505
12591
  }
12506
12592
  }
12507
- return (event) => {
12593
+ return fn._withKeys || (fn._withKeys = (event) => {
12508
12594
  if (!("key" in event)) {
12509
12595
  return;
12510
12596
  }
@@ -12532,7 +12618,7 @@ const withKeys = (fn, modifiers) => {
12532
12618
  }
12533
12619
  }
12534
12620
  }
12535
- };
12621
+ });
12536
12622
  };
12537
12623
 
12538
12624
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12670,7 +12756,9 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12670
12756
  BaseTransition: BaseTransition,
12671
12757
  BaseTransitionPropsValidators: BaseTransitionPropsValidators,
12672
12758
  Comment: Comment,
12759
+ DeprecationTypes: DeprecationTypes,
12673
12760
  EffectScope: EffectScope,
12761
+ ErrorCodes: ErrorCodes,
12674
12762
  ErrorTypeStrings: ErrorTypeStrings,
12675
12763
  Fragment: Fragment,
12676
12764
  KeepAlive: KeepAlive,
@@ -12679,8 +12767,10 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12679
12767
  Suspense: Suspense,
12680
12768
  Teleport: Teleport,
12681
12769
  Text: Text,
12770
+ TrackOpTypes: TrackOpTypes,
12682
12771
  Transition: Transition,
12683
12772
  TransitionGroup: TransitionGroup,
12773
+ TriggerOpTypes: TriggerOpTypes,
12684
12774
  VueElement: VueElement,
12685
12775
  assertNumber: assertNumber,
12686
12776
  callWithAsyncErrorHandling: callWithAsyncErrorHandling,
@@ -13137,7 +13227,9 @@ class Tokenizer {
13137
13227
  this.inRCDATA = false;
13138
13228
  /** For disabling RCDATA tags handling */
13139
13229
  this.inXML = false;
13140
- /** Reocrd newline positions for fast line / column calculation */
13230
+ /** For disabling interpolation parsing in v-pre */
13231
+ this.inVPre = false;
13232
+ /** Record newline positions for fast line / column calculation */
13141
13233
  this.newlines = [];
13142
13234
  this.mode = 0;
13143
13235
  this.delimiterOpen = defaultDelimitersOpen;
@@ -13162,6 +13254,7 @@ class Tokenizer {
13162
13254
  this.sectionStart = 0;
13163
13255
  this.index = 0;
13164
13256
  this.baseState = 1;
13257
+ this.inRCDATA = false;
13165
13258
  this.currentSequence = void 0;
13166
13259
  this.newlines.length = 0;
13167
13260
  this.delimiterOpen = defaultDelimitersOpen;
@@ -13202,7 +13295,7 @@ class Tokenizer {
13202
13295
  this.sectionStart = this.index;
13203
13296
  } else if (c === 38) {
13204
13297
  this.startEntity();
13205
- } else if (c === this.delimiterOpen[0]) {
13298
+ } else if (!this.inVPre && c === this.delimiterOpen[0]) {
13206
13299
  this.state = 2;
13207
13300
  this.delimiterIndex = 0;
13208
13301
  this.stateInterpolationOpen(c);
@@ -14071,16 +14164,14 @@ const errorMessages = {
14071
14164
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
14072
14165
  [45]: `Error parsing JavaScript expression: `,
14073
14166
  [46]: `<KeepAlive> expects exactly one child component.`,
14167
+ [47]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
14074
14168
  // generic errors
14075
- [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
14076
- [48]: `ES module mode is not supported in this build of compiler.`,
14077
- [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14078
- [50]: `"scopeId" option is only supported in module mode.`,
14079
- // deprecations
14080
- [51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
14081
- [52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
14169
+ [48]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
14170
+ [49]: `ES module mode is not supported in this build of compiler.`,
14171
+ [50]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
14172
+ [51]: `"scopeId" option is only supported in module mode.`,
14082
14173
  // just to fulfill types
14083
- [53]: ``
14174
+ [52]: ``
14084
14175
  };
14085
14176
 
14086
14177
  const isStaticExp = (p) => p.type === 4 && p.isStatic;
@@ -14335,7 +14426,8 @@ const defaultParserOptions = {
14335
14426
  isCustomElement: NO,
14336
14427
  onError: defaultOnError,
14337
14428
  onWarn: defaultOnWarn,
14338
- comments: true
14429
+ comments: true,
14430
+ prefixIdentifiers: false
14339
14431
  };
14340
14432
  let currentOptions = defaultParserOptions;
14341
14433
  let currentRoot = null;
@@ -14377,7 +14469,7 @@ const tokenizer = new Tokenizer(stack, {
14377
14469
  }
14378
14470
  addNode({
14379
14471
  type: 5,
14380
- content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
14472
+ content: createExp(exp, false, getLoc(innerStart, innerEnd)),
14381
14473
  loc: getLoc(start, end)
14382
14474
  });
14383
14475
  },
@@ -14470,7 +14562,7 @@ const tokenizer = new Tokenizer(stack, {
14470
14562
  loc: getLoc(start)
14471
14563
  };
14472
14564
  if (name === "pre") {
14473
- inVPre = true;
14565
+ inVPre = tokenizer.inVPre = true;
14474
14566
  currentVPreBoundary = currentOpenTag;
14475
14567
  const props = currentOpenTag.props;
14476
14568
  for (let i = 0; i < props.length; i++) {
@@ -14482,13 +14574,15 @@ const tokenizer = new Tokenizer(stack, {
14482
14574
  }
14483
14575
  },
14484
14576
  ondirarg(start, end) {
14577
+ if (start === end)
14578
+ return;
14485
14579
  const arg = getSlice(start, end);
14486
14580
  if (inVPre) {
14487
14581
  currentProp.name += arg;
14488
14582
  setLocEnd(currentProp.nameLoc, end);
14489
14583
  } else {
14490
14584
  const isStatic = arg[0] !== `[`;
14491
- currentProp.arg = createSimpleExpression(
14585
+ currentProp.arg = createExp(
14492
14586
  isStatic ? arg : arg.slice(1, -1),
14493
14587
  isStatic,
14494
14588
  getLoc(start, end),
@@ -14555,10 +14649,22 @@ const tokenizer = new Tokenizer(stack, {
14555
14649
  tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
14556
14650
  }
14557
14651
  } else {
14558
- currentProp.exp = createSimpleExpression(
14652
+ let expParseMode = 0 /* Normal */;
14653
+ {
14654
+ if (currentProp.name === "for") {
14655
+ expParseMode = 3 /* Skip */;
14656
+ } else if (currentProp.name === "slot") {
14657
+ expParseMode = 1 /* Params */;
14658
+ } else if (currentProp.name === "on" && currentAttrValue.includes(";")) {
14659
+ expParseMode = 2 /* Statements */;
14660
+ }
14661
+ }
14662
+ currentProp.exp = createExp(
14559
14663
  currentAttrValue,
14560
14664
  false,
14561
- getLoc(currentAttrStartIndex, currentAttrEndIndex)
14665
+ getLoc(currentAttrStartIndex, currentAttrEndIndex),
14666
+ 0,
14667
+ expParseMode
14562
14668
  );
14563
14669
  if (currentProp.name === "for") {
14564
14670
  currentProp.forParseResult = parseForExpression(currentProp.exp);
@@ -14661,10 +14767,16 @@ function parseForExpression(input) {
14661
14767
  if (!inMatch)
14662
14768
  return;
14663
14769
  const [, LHS, RHS] = inMatch;
14664
- const createAliasExpression = (content, offset) => {
14770
+ const createAliasExpression = (content, offset, asParam = false) => {
14665
14771
  const start = loc.start.offset + offset;
14666
14772
  const end = start + content.length;
14667
- return createSimpleExpression(content, false, getLoc(start, end));
14773
+ return createExp(
14774
+ content,
14775
+ false,
14776
+ getLoc(start, end),
14777
+ 0,
14778
+ asParam ? 1 /* Params */ : 0 /* Normal */
14779
+ );
14668
14780
  };
14669
14781
  const result = {
14670
14782
  source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
@@ -14682,7 +14794,7 @@ function parseForExpression(input) {
14682
14794
  let keyOffset;
14683
14795
  if (keyContent) {
14684
14796
  keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
14685
- result.key = createAliasExpression(keyContent, keyOffset);
14797
+ result.key = createAliasExpression(keyContent, keyOffset, true);
14686
14798
  }
14687
14799
  if (iteratorMatch[2]) {
14688
14800
  const indexContent = iteratorMatch[2].trim();
@@ -14692,13 +14804,14 @@ function parseForExpression(input) {
14692
14804
  exp.indexOf(
14693
14805
  indexContent,
14694
14806
  result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
14695
- )
14807
+ ),
14808
+ true
14696
14809
  );
14697
14810
  }
14698
14811
  }
14699
14812
  }
14700
14813
  if (valueContent) {
14701
- result.value = createAliasExpression(valueContent, trimmedOffset);
14814
+ result.value = createAliasExpression(valueContent, trimmedOffset, true);
14702
14815
  }
14703
14816
  return result;
14704
14817
  }
@@ -14769,7 +14882,7 @@ function onCloseTag(el, end, isImplied = false) {
14769
14882
  inPre--;
14770
14883
  }
14771
14884
  if (currentVPreBoundary === el) {
14772
- inVPre = false;
14885
+ inVPre = tokenizer.inVPre = false;
14773
14886
  currentVPreBoundary = null;
14774
14887
  }
14775
14888
  if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
@@ -15004,8 +15117,36 @@ function dirToAttr(dir) {
15004
15117
  }
15005
15118
  return attr;
15006
15119
  }
15007
- function emitError(code, index) {
15008
- currentOptions.onError(createCompilerError(code, getLoc(index, index)));
15120
+ function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0 /* Normal */) {
15121
+ const exp = createSimpleExpression(content, isStatic, loc, constType);
15122
+ if (!isStatic && currentOptions.prefixIdentifiers && parseMode !== 3 /* Skip */ && content.trim()) {
15123
+ if (isSimpleIdentifier(content)) {
15124
+ exp.ast = null;
15125
+ return exp;
15126
+ }
15127
+ try {
15128
+ const plugins = currentOptions.expressionPlugins;
15129
+ const options = {
15130
+ plugins: plugins ? [...plugins, "typescript"] : ["typescript"]
15131
+ };
15132
+ if (parseMode === 2 /* Statements */) {
15133
+ exp.ast = parser.parse(` ${content} `, options).program;
15134
+ } else if (parseMode === 1 /* Params */) {
15135
+ exp.ast = parser.parseExpression(`(${content})=>{}`, options);
15136
+ } else {
15137
+ exp.ast = parser.parseExpression(`(${content})`, options);
15138
+ }
15139
+ } catch (e) {
15140
+ exp.ast = false;
15141
+ emitError(45, loc.start.offset, e.message);
15142
+ }
15143
+ }
15144
+ return exp;
15145
+ }
15146
+ function emitError(code, index, message) {
15147
+ currentOptions.onError(
15148
+ createCompilerError(code, getLoc(index, index), void 0, message)
15149
+ );
15009
15150
  }
15010
15151
  function reset() {
15011
15152
  tokenizer.reset();
@@ -15036,6 +15177,7 @@ function baseParse(input, options) {
15036
15177
  }
15037
15178
  }
15038
15179
  tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
15180
+ tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
15039
15181
  const delimiters = options == null ? void 0 : options.delimiters;
15040
15182
  if (delimiters) {
15041
15183
  tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
@@ -16394,7 +16536,7 @@ function genReturnStatement({ returns }, context) {
16394
16536
  }
16395
16537
 
16396
16538
  function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) {
16397
- const rootExp = root.type === "Program" && root.body[0].type === "ExpressionStatement" && root.body[0].expression;
16539
+ const rootExp = root.type === "Program" ? root.body[0].type === "ExpressionStatement" && root.body[0].expression : root;
16398
16540
  estreeWalker.walk(root, {
16399
16541
  enter(node, parent) {
16400
16542
  parent && parentStack.push(parent);
@@ -16743,7 +16885,11 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16743
16885
  };
16744
16886
  const rawExp = node.content;
16745
16887
  const bailConstant = constantBailRE.test(rawExp);
16746
- if (isSimpleIdentifier(rawExp)) {
16888
+ let ast = node.ast;
16889
+ if (ast === false) {
16890
+ return node;
16891
+ }
16892
+ if (ast === null || !ast && isSimpleIdentifier(rawExp)) {
16747
16893
  const isScopeVarReference = context.identifiers[rawExp];
16748
16894
  const isAllowedGlobal = isGloballyAllowed(rawExp);
16749
16895
  const isLiteral = isLiteralWhitelisted(rawExp);
@@ -16761,22 +16907,23 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16761
16907
  }
16762
16908
  return node;
16763
16909
  }
16764
- let ast;
16765
- const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
16766
- try {
16767
- ast = parser.parse(source, {
16768
- plugins: context.expressionPlugins
16769
- }).program;
16770
- } catch (e) {
16771
- context.onError(
16772
- createCompilerError(
16773
- 45,
16774
- node.loc,
16775
- void 0,
16776
- e.message
16777
- )
16778
- );
16779
- return node;
16910
+ if (!ast) {
16911
+ const source = asRawStatements ? ` ${rawExp} ` : `(${rawExp})${asParams ? `=>{}` : ``}`;
16912
+ try {
16913
+ ast = parser.parse(source, {
16914
+ plugins: context.expressionPlugins
16915
+ }).program;
16916
+ } catch (e) {
16917
+ context.onError(
16918
+ createCompilerError(
16919
+ 45,
16920
+ node.loc,
16921
+ void 0,
16922
+ e.message
16923
+ )
16924
+ );
16925
+ return node;
16926
+ }
16780
16927
  }
16781
16928
  const ids = [];
16782
16929
  const parentStack = [];
@@ -16819,15 +16966,15 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16819
16966
  if (leadingText.length || id.prefix) {
16820
16967
  children.push(leadingText + (id.prefix || ``));
16821
16968
  }
16822
- const source2 = rawExp.slice(start, end);
16969
+ const source = rawExp.slice(start, end);
16823
16970
  children.push(
16824
16971
  createSimpleExpression(
16825
16972
  id.name,
16826
16973
  false,
16827
16974
  {
16828
- start: advancePositionWithClone(node.loc.start, source2, start),
16829
- end: advancePositionWithClone(node.loc.start, source2, end),
16830
- source: source2
16975
+ start: advancePositionWithClone(node.loc.start, source, start),
16976
+ end: advancePositionWithClone(node.loc.start, source, end),
16977
+ source
16831
16978
  },
16832
16979
  id.isConstant ? 3 : 0
16833
16980
  )
@@ -16839,6 +16986,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16839
16986
  let ret;
16840
16987
  if (children.length) {
16841
16988
  ret = createCompoundExpression(children, node.loc);
16989
+ ret.ast = ast;
16842
16990
  } else {
16843
16991
  ret = node;
16844
16992
  ret.constType = bailConstant ? 0 : 3;
@@ -17798,6 +17946,10 @@ function resolveSetupReference(name, context) {
17798
17946
  `${context.helperString(UNREF)}(${fromMaybeRef})`
17799
17947
  ) : `$setup[${JSON.stringify(fromMaybeRef)}]`;
17800
17948
  }
17949
+ const fromProps = checkType("props");
17950
+ if (fromProps) {
17951
+ return `${context.helperString(UNREF)}(${context.inline ? "__props" : "$props"}[${JSON.stringify(fromProps)}])`;
17952
+ }
17801
17953
  }
17802
17954
  function buildProps(node, context, props = node.props, isComponent, isDynamicComponent, ssr = false) {
17803
17955
  const { tag, loc: elementLoc, children } = node;
@@ -17838,6 +17990,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
17838
17990
  if (isEventHandler && isReservedProp(name)) {
17839
17991
  hasVnodeHook = true;
17840
17992
  }
17993
+ if (isEventHandler && value.type === 14) {
17994
+ value = value.arguments[0];
17995
+ }
17841
17996
  if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) {
17842
17997
  return;
17843
17998
  }
@@ -18305,9 +18460,7 @@ const transformOn$1 = (dir, node, context, augmentor) => {
18305
18460
  if (arg.isStatic) {
18306
18461
  let rawName = arg.content;
18307
18462
  if (rawName.startsWith("vnode")) {
18308
- context.onWarn(
18309
- createCompilerError(51, arg.loc)
18310
- );
18463
+ context.onError(createCompilerError(47, arg.loc));
18311
18464
  }
18312
18465
  if (rawName.startsWith("vue:")) {
18313
18466
  rawName = `vnode-${rawName.slice(4)}`;
@@ -18841,10 +18994,10 @@ function baseCompile(source, options = {}) {
18841
18994
  const isModuleMode = options.mode === "module";
18842
18995
  const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
18843
18996
  if (!prefixIdentifiers && options.cacheHandlers) {
18844
- onError(createCompilerError(49));
18997
+ onError(createCompilerError(50));
18845
18998
  }
18846
18999
  if (options.scopeId && !isModuleMode) {
18847
- onError(createCompilerError(50));
19000
+ onError(createCompilerError(51));
18848
19001
  }
18849
19002
  const ast = isString(source) ? baseParse(source, options) : source;
18850
19003
  const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers);