@vue/compat 3.3.7 → 3.3.9

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.
@@ -962,7 +962,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
962
962
  }
963
963
  function createReadonlyMethod(type) {
964
964
  return function(...args) {
965
- return type === "delete" ? false : this;
965
+ return type === "delete" ? false : type === "clear" ? void 0 : this;
966
966
  };
967
967
  }
968
968
  function createInstrumentations() {
@@ -1972,9 +1972,19 @@ function renderComponentRoot(instance) {
1972
1972
  try {
1973
1973
  if (vnode.shapeFlag & 4) {
1974
1974
  const proxyToUse = withProxy || proxy;
1975
+ const thisProxy = false ? new Proxy(proxyToUse, {
1976
+ get(target, key, receiver) {
1977
+ warn(
1978
+ `Property '${String(
1979
+ key
1980
+ )}' was accessed via 'this'. Avoid using 'this' in templates.`
1981
+ );
1982
+ return Reflect.get(target, key, receiver);
1983
+ }
1984
+ }) : proxyToUse;
1975
1985
  result = normalizeVNode(
1976
1986
  render.call(
1977
- proxyToUse,
1987
+ thisProxy,
1978
1988
  proxyToUse,
1979
1989
  renderCache,
1980
1990
  props,
@@ -2149,6 +2159,56 @@ function updateHOCHostEl({ vnode, parent }, el) {
2149
2159
  }
2150
2160
  }
2151
2161
 
2162
+ const COMPONENTS = "components";
2163
+ const DIRECTIVES = "directives";
2164
+ const FILTERS = "filters";
2165
+ function resolveComponent(name, maybeSelfReference) {
2166
+ return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
2167
+ }
2168
+ const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
2169
+ function resolveDynamicComponent(component) {
2170
+ if (isString(component)) {
2171
+ return resolveAsset(COMPONENTS, component, false) || component;
2172
+ } else {
2173
+ return component || NULL_DYNAMIC_COMPONENT;
2174
+ }
2175
+ }
2176
+ function resolveDirective(name) {
2177
+ return resolveAsset(DIRECTIVES, name);
2178
+ }
2179
+ function resolveFilter$1(name) {
2180
+ return resolveAsset(FILTERS, name);
2181
+ }
2182
+ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
2183
+ const instance = currentRenderingInstance || currentInstance;
2184
+ if (instance) {
2185
+ const Component = instance.type;
2186
+ if (type === COMPONENTS) {
2187
+ const selfName = getComponentName(
2188
+ Component,
2189
+ false
2190
+ /* do not include inferred name to avoid breaking existing code */
2191
+ );
2192
+ if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
2193
+ return Component;
2194
+ }
2195
+ }
2196
+ const res = (
2197
+ // local registration
2198
+ // check instance[type] first which is resolved for options API
2199
+ resolve(instance[type] || Component[type], name) || // global registration
2200
+ resolve(instance.appContext[type], name)
2201
+ );
2202
+ if (!res && maybeSelfReference) {
2203
+ return Component;
2204
+ }
2205
+ return res;
2206
+ }
2207
+ }
2208
+ function resolve(registry, name) {
2209
+ return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
2210
+ }
2211
+
2152
2212
  const isSuspense = (type) => type.__isSuspense;
2153
2213
  const SuspenseImpl = {
2154
2214
  name: "Suspense",
@@ -2811,6 +2871,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
2811
2871
  let onCleanup = (fn) => {
2812
2872
  cleanup = effect.onStop = () => {
2813
2873
  callWithErrorHandling(fn, instance, 4);
2874
+ cleanup = effect.onStop = void 0;
2814
2875
  };
2815
2876
  };
2816
2877
  let ssrCleanup;
@@ -3288,7 +3349,11 @@ function emptyPlaceholder(vnode) {
3288
3349
  }
3289
3350
  }
3290
3351
  function getKeepAliveChild(vnode) {
3291
- return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;
3352
+ return isKeepAlive(vnode) ? (
3353
+ // #7121 ensure get the child component subtree in case
3354
+ // it's been replaced during HMR
3355
+ vnode.children ? vnode.children[0] : void 0
3356
+ ) : vnode;
3292
3357
  }
3293
3358
  function setTransitionHooks(vnode, hooks) {
3294
3359
  if (vnode.shapeFlag & 6 && vnode.component) {
@@ -3784,56 +3849,6 @@ function getCompatListeners(instance) {
3784
3849
  return listeners;
3785
3850
  }
3786
3851
 
3787
- const COMPONENTS = "components";
3788
- const DIRECTIVES = "directives";
3789
- const FILTERS = "filters";
3790
- function resolveComponent(name, maybeSelfReference) {
3791
- return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
3792
- }
3793
- const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
3794
- function resolveDynamicComponent(component) {
3795
- if (isString(component)) {
3796
- return resolveAsset(COMPONENTS, component, false) || component;
3797
- } else {
3798
- return component || NULL_DYNAMIC_COMPONENT;
3799
- }
3800
- }
3801
- function resolveDirective(name) {
3802
- return resolveAsset(DIRECTIVES, name);
3803
- }
3804
- function resolveFilter$1(name) {
3805
- return resolveAsset(FILTERS, name);
3806
- }
3807
- function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
3808
- const instance = currentRenderingInstance || currentInstance;
3809
- if (instance) {
3810
- const Component = instance.type;
3811
- if (type === COMPONENTS) {
3812
- const selfName = getComponentName(
3813
- Component,
3814
- false
3815
- /* do not include inferred name to avoid breaking existing code */
3816
- );
3817
- if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
3818
- return Component;
3819
- }
3820
- }
3821
- const res = (
3822
- // local registration
3823
- // check instance[type] first which is resolved for options API
3824
- resolve(instance[type] || Component[type], name) || // global registration
3825
- resolve(instance.appContext[type], name)
3826
- );
3827
- if (!res && maybeSelfReference) {
3828
- return Component;
3829
- }
3830
- return res;
3831
- }
3832
- }
3833
- function resolve(registry, name) {
3834
- return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
3835
- }
3836
-
3837
3852
  function convertLegacyRenderFn(instance) {
3838
3853
  const Component2 = instance.type;
3839
3854
  const render = Component2.render;
@@ -5072,7 +5087,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5072
5087
  return vm;
5073
5088
  }
5074
5089
  }
5075
- Vue.version = `2.6.14-compat:${"3.3.7"}`;
5090
+ Vue.version = `2.6.14-compat:${"3.3.9"}`;
5076
5091
  Vue.config = singletonApp.config;
5077
5092
  Vue.use = (p, ...options) => {
5078
5093
  if (p && isFunction(p.install)) {
@@ -6124,15 +6139,15 @@ function createHydrationFunctions(rendererInternals) {
6124
6139
  }
6125
6140
  break;
6126
6141
  case Comment:
6127
- if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6128
- if (node.tagName.toLowerCase() === "template") {
6129
- const content = vnode.el.content.firstChild;
6130
- replaceNode(content, node, parentComponent);
6131
- vnode.el = node = content;
6132
- nextNode = nextSibling(node);
6133
- } else {
6134
- nextNode = onMismatch();
6135
- }
6142
+ if (isTemplateNode(node)) {
6143
+ nextNode = nextSibling(node);
6144
+ replaceNode(
6145
+ vnode.el = node.content.firstChild,
6146
+ node,
6147
+ parentComponent
6148
+ );
6149
+ } else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
6150
+ nextNode = onMismatch();
6136
6151
  } else {
6137
6152
  nextNode = nextSibling(node);
6138
6153
  }
@@ -6253,15 +6268,16 @@ function createHydrationFunctions(rendererInternals) {
6253
6268
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
6254
6269
  optimized = optimized || !!vnode.dynamicChildren;
6255
6270
  const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
6256
- const forcePatchValue = type === "input" && dirs || type === "option";
6257
- if (forcePatchValue || patchFlag !== -1) {
6271
+ const forcePatch = type === "input" || type === "option";
6272
+ if (forcePatch || patchFlag !== -1) {
6258
6273
  if (dirs) {
6259
6274
  invokeDirectiveHook(vnode, null, parentComponent, "created");
6260
6275
  }
6261
6276
  if (props) {
6262
- if (forcePatchValue || !optimized || patchFlag & (16 | 32)) {
6277
+ if (forcePatch || !optimized || patchFlag & (16 | 32)) {
6263
6278
  for (const key in props) {
6264
- if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) {
6279
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
6280
+ key[0] === ".") {
6265
6281
  patchProp(
6266
6282
  el,
6267
6283
  key,
@@ -6446,8 +6462,7 @@ function createHydrationFunctions(rendererInternals) {
6446
6462
  let parent = parentComponent;
6447
6463
  while (parent) {
6448
6464
  if (parent.vnode.el === oldNode) {
6449
- parent.vnode.el = newNode;
6450
- parent.subTree.el = newNode;
6465
+ parent.vnode.el = parent.subTree.el = newNode;
6451
6466
  }
6452
6467
  parent = parent.parent;
6453
6468
  }
@@ -7834,6 +7849,7 @@ const resolveTarget = (props, select) => {
7834
7849
  }
7835
7850
  };
7836
7851
  const TeleportImpl = {
7852
+ name: "Teleport",
7837
7853
  __isTeleport: true,
7838
7854
  process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
7839
7855
  const {
@@ -8800,7 +8816,7 @@ function isMemoSame(cached, memo) {
8800
8816
  return true;
8801
8817
  }
8802
8818
 
8803
- const version = "3.3.7";
8819
+ const version = "3.3.9";
8804
8820
  const _ssrUtils = {
8805
8821
  createComponentInstance,
8806
8822
  setupComponent,
@@ -9955,21 +9971,20 @@ const vModelText = {
9955
9971
  el[assignKey] = getModelAssigner(vnode);
9956
9972
  if (el.composing)
9957
9973
  return;
9974
+ const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
9975
+ const newValue = value == null ? "" : value;
9976
+ if (elValue === newValue) {
9977
+ return;
9978
+ }
9958
9979
  if (document.activeElement === el && el.type !== "range") {
9959
9980
  if (lazy) {
9960
9981
  return;
9961
9982
  }
9962
- if (trim && el.value.trim() === value) {
9963
- return;
9964
- }
9965
- if ((number || el.type === "number") && looseToNumber(el.value) === value) {
9983
+ if (trim && el.value.trim() === newValue) {
9966
9984
  return;
9967
9985
  }
9968
9986
  }
9969
- const newValue = value == null ? "" : value;
9970
- if (el.value !== newValue) {
9971
- el.value = newValue;
9972
- }
9987
+ el.value = newValue;
9973
9988
  }
9974
9989
  };
9975
9990
  const vModelCheckbox = {
@@ -11035,6 +11050,7 @@ function getMemoedVNodeCall(node) {
11035
11050
  return node;
11036
11051
  }
11037
11052
  }
11053
+ const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
11038
11054
 
11039
11055
  function getCompatValue(key, context) {
11040
11056
  const config = context.options ? context.options.compatConfig : context.compatConfig;
@@ -13164,6 +13180,15 @@ function walkBlockDeclarations(block, onIdent) {
13164
13180
  if (stmt.declare || !stmt.id)
13165
13181
  continue;
13166
13182
  onIdent(stmt.id);
13183
+ } else if (stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement") {
13184
+ const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left;
13185
+ if (variable && variable.type === "VariableDeclaration") {
13186
+ for (const decl of variable.declarations) {
13187
+ for (const id of extractIdentifiers(decl.id)) {
13188
+ onIdent(id);
13189
+ }
13190
+ }
13191
+ }
13167
13192
  }
13168
13193
  }
13169
13194
  }
@@ -13416,8 +13441,8 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
13416
13441
  const isScopeVarReference = context.identifiers[rawExp];
13417
13442
  const isAllowedGlobal = isGloballyAllowed(rawExp);
13418
13443
  const isLiteral = isLiteralWhitelisted(rawExp);
13419
- if (!asParams && !isScopeVarReference && !isAllowedGlobal && !isLiteral) {
13420
- if (isConst(bindingMetadata[node.content])) {
13444
+ if (!asParams && !isScopeVarReference && !isLiteral && (!isAllowedGlobal || bindingMetadata[rawExp])) {
13445
+ if (isConst(bindingMetadata[rawExp])) {
13421
13446
  node.constType = 1;
13422
13447
  }
13423
13448
  node.content = rewriteIdentifier(rawExp);
@@ -13943,7 +13968,6 @@ function processFor(node, dir, context, processCodegen) {
13943
13968
  onExit();
13944
13969
  };
13945
13970
  }
13946
- const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
13947
13971
  const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
13948
13972
  const stripParensRE = /^\(|\)$/g;
13949
13973
  function parseForExpression(input, context) {
@@ -14606,7 +14630,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14606
14630
  )
14607
14631
  );
14608
14632
  } else {
14609
- const { name, arg, exp, loc } = prop;
14633
+ const { name, arg, exp, loc, modifiers } = prop;
14610
14634
  const isVBind = name === "bind";
14611
14635
  const isVOn = name === "on";
14612
14636
  if (name === "slot") {
@@ -14678,6 +14702,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
14678
14702
  }
14679
14703
  continue;
14680
14704
  }
14705
+ if (isVBind && modifiers.includes("prop")) {
14706
+ patchFlag |= 32;
14707
+ }
14681
14708
  const directiveTransform = context.directiveTransforms[name];
14682
14709
  if (directiveTransform) {
14683
14710
  const { props: props2, needRuntime } = directiveTransform(prop, node, context);