@vue/compat 3.4.6 → 3.4.8

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
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  var parser = require('@babel/parser');
@@ -3210,8 +3215,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
3210
3215
  return false;
3211
3216
  }
3212
3217
  function updateHOCHostEl({ vnode, parent }, el) {
3213
- if (!el)
3214
- return;
3215
3218
  while (parent) {
3216
3219
  const root = parent.subTree;
3217
3220
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -3856,7 +3859,12 @@ function queueEffectWithSuspense(fn, suspense) {
3856
3859
  function setActiveBranch(suspense, branch) {
3857
3860
  suspense.activeBranch = branch;
3858
3861
  const { vnode, parentComponent } = suspense;
3859
- const el = vnode.el = branch.el;
3862
+ let el = branch.el;
3863
+ while (!el && branch.component) {
3864
+ branch = branch.component.subTree;
3865
+ el = branch.el;
3866
+ }
3867
+ vnode.el = el;
3860
3868
  if (parentComponent && parentComponent.subTree === vnode) {
3861
3869
  parentComponent.vnode.el = el;
3862
3870
  updateHOCHostEl(parentComponent, el);
@@ -4151,14 +4159,9 @@ function instanceWatch(source, value, options) {
4151
4159
  cb = value.handler;
4152
4160
  options = value;
4153
4161
  }
4154
- const cur = currentInstance;
4155
- setCurrentInstance(this);
4162
+ const reset = setCurrentInstance(this);
4156
4163
  const res = doWatch(getter, cb.bind(publicThis), options);
4157
- if (cur) {
4158
- setCurrentInstance(cur);
4159
- } else {
4160
- unsetCurrentInstance();
4161
- }
4164
+ reset();
4162
4165
  return res;
4163
4166
  }
4164
4167
  function createPathGetter(ctx, path) {
@@ -4210,12 +4213,11 @@ function validateDirectiveName(name) {
4210
4213
  }
4211
4214
  }
4212
4215
  function withDirectives(vnode, directives) {
4213
- const internalInstance = currentRenderingInstance;
4214
- if (internalInstance === null) {
4216
+ if (currentRenderingInstance === null) {
4215
4217
  warn$1(`withDirectives can only be used inside render functions.`);
4216
4218
  return vnode;
4217
4219
  }
4218
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
4220
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
4219
4221
  const bindings = vnode.dirs || (vnode.dirs = []);
4220
4222
  for (let i = 0; i < directives.length; i++) {
4221
4223
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -5010,9 +5012,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
5010
5012
  return;
5011
5013
  }
5012
5014
  pauseTracking();
5013
- setCurrentInstance(target);
5015
+ const reset = setCurrentInstance(target);
5014
5016
  const res = callWithAsyncErrorHandling(hook, target, type, args);
5015
- unsetCurrentInstance();
5017
+ reset();
5016
5018
  resetTracking();
5017
5019
  return res;
5018
5020
  });
@@ -6604,7 +6606,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6604
6606
  return vm;
6605
6607
  }
6606
6608
  }
6607
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
6609
+ Vue.version = `2.6.14-compat:${"3.4.8"}`;
6608
6610
  Vue.config = singletonApp.config;
6609
6611
  Vue.use = (p, ...options) => {
6610
6612
  if (p && isFunction(p.install)) {
@@ -7444,12 +7446,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
7444
7446
  if (key in propsDefaults) {
7445
7447
  value = propsDefaults[key];
7446
7448
  } else {
7447
- setCurrentInstance(instance);
7449
+ const reset = setCurrentInstance(instance);
7448
7450
  value = propsDefaults[key] = defaultValue.call(
7449
7451
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props, key) : null,
7450
7452
  props
7451
7453
  );
7452
- unsetCurrentInstance();
7454
+ reset();
7453
7455
  }
7454
7456
  } else {
7455
7457
  value = defaultValue;
@@ -8330,29 +8332,34 @@ function propHasMismatch(el, key, clientValue, vnode) {
8330
8332
  let actual;
8331
8333
  let expected;
8332
8334
  if (key === "class") {
8333
- actual = toClassSet(el.getAttribute("class") || "");
8334
- expected = toClassSet(normalizeClass(clientValue));
8335
- if (!isSetEqual(actual, expected)) {
8335
+ actual = el.getAttribute("class");
8336
+ expected = normalizeClass(clientValue);
8337
+ if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
8336
8338
  mismatchType = mismatchKey = `class`;
8337
8339
  }
8338
8340
  } else if (key === "style") {
8339
- actual = toStyleMap(el.getAttribute("style") || "");
8340
- expected = toStyleMap(
8341
- isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue))
8342
- );
8341
+ actual = el.getAttribute("style");
8342
+ expected = isString(clientValue) ? clientValue : stringifyStyle(normalizeStyle(clientValue));
8343
+ const actualMap = toStyleMap(actual);
8344
+ const expectedMap = toStyleMap(expected);
8343
8345
  if (vnode.dirs) {
8344
8346
  for (const { dir, value } of vnode.dirs) {
8345
8347
  if (dir.name === "show" && !value) {
8346
- expected.set("display", "none");
8348
+ expectedMap.set("display", "none");
8347
8349
  }
8348
8350
  }
8349
8351
  }
8350
- if (!isMapEqual(actual, expected)) {
8352
+ if (!isMapEqual(actualMap, expectedMap)) {
8351
8353
  mismatchType = mismatchKey = "style";
8352
8354
  }
8353
8355
  } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
8354
- actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8355
- expected = isBooleanAttr(key) ? includeBooleanAttr(clientValue) ? "" : false : clientValue == null ? "" : String(clientValue);
8356
+ if (isBooleanAttr(key)) {
8357
+ actual = el.hasAttribute(key);
8358
+ expected = includeBooleanAttr(clientValue);
8359
+ } else {
8360
+ actual = el.hasAttribute(key) ? el.getAttribute(key) : key in el ? el[key] : "";
8361
+ expected = clientValue == null ? "" : String(clientValue);
8362
+ }
8356
8363
  if (actual !== expected) {
8357
8364
  mismatchType = `attribute`;
8358
8365
  mismatchKey = key;
@@ -10796,14 +10803,7 @@ function createComponentInstance(vnode, parent, suspense) {
10796
10803
  return instance;
10797
10804
  }
10798
10805
  let currentInstance = null;
10799
- const getCurrentInstance = () => {
10800
- if (isInComputedGetter) {
10801
- warn$1(
10802
- `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
10803
- );
10804
- }
10805
- return currentInstance || currentRenderingInstance;
10806
- };
10806
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
10807
10807
  let internalSetCurrentInstance;
10808
10808
  let setInSSRSetupState;
10809
10809
  {
@@ -10830,8 +10830,13 @@ let setInSSRSetupState;
10830
10830
  );
10831
10831
  }
10832
10832
  const setCurrentInstance = (instance) => {
10833
+ const prev = currentInstance;
10833
10834
  internalSetCurrentInstance(instance);
10834
10835
  instance.scope.on();
10836
+ return () => {
10837
+ instance.scope.off();
10838
+ internalSetCurrentInstance(prev);
10839
+ };
10835
10840
  };
10836
10841
  const unsetCurrentInstance = () => {
10837
10842
  currentInstance && currentInstance.scope.off();
@@ -10893,7 +10898,7 @@ function setupStatefulComponent(instance, isSSR) {
10893
10898
  const { setup } = Component;
10894
10899
  if (setup) {
10895
10900
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
10896
- setCurrentInstance(instance);
10901
+ const reset = setCurrentInstance(instance);
10897
10902
  pauseTracking();
10898
10903
  const setupResult = callWithErrorHandling(
10899
10904
  setup,
@@ -10905,7 +10910,7 @@ function setupStatefulComponent(instance, isSSR) {
10905
10910
  ]
10906
10911
  );
10907
10912
  resetTracking();
10908
- unsetCurrentInstance();
10913
+ reset();
10909
10914
  if (isPromise(setupResult)) {
10910
10915
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
10911
10916
  if (isSSR) {
@@ -11013,13 +11018,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
11013
11018
  }
11014
11019
  }
11015
11020
  if (!skipOptions) {
11016
- setCurrentInstance(instance);
11021
+ const reset = setCurrentInstance(instance);
11017
11022
  pauseTracking();
11018
11023
  try {
11019
11024
  applyOptions(instance);
11020
11025
  } finally {
11021
11026
  resetTracking();
11022
- unsetCurrentInstance();
11027
+ reset();
11023
11028
  }
11024
11029
  }
11025
11030
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -11146,25 +11151,7 @@ function isClassComponent(value) {
11146
11151
  return isFunction(value) && "__vccOpts" in value;
11147
11152
  }
11148
11153
 
11149
- let isInComputedGetter = false;
11150
- function wrapComputedGetter(getter) {
11151
- return () => {
11152
- isInComputedGetter = true;
11153
- try {
11154
- return getter();
11155
- } finally {
11156
- isInComputedGetter = false;
11157
- }
11158
- };
11159
- }
11160
11154
  const computed = (getterOrOptions, debugOptions) => {
11161
- {
11162
- if (isFunction(getterOrOptions)) {
11163
- getterOrOptions = wrapComputedGetter(getterOrOptions);
11164
- } else {
11165
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
11166
- }
11167
- }
11168
11155
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
11169
11156
  };
11170
11157
 
@@ -11390,7 +11377,7 @@ function isMemoSame(cached, memo) {
11390
11377
  return true;
11391
11378
  }
11392
11379
 
11393
- const version = "3.4.6";
11380
+ const version = "3.4.8";
11394
11381
  const warn = warn$1 ;
11395
11382
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11396
11383
  const devtools = devtools$1 ;
@@ -15504,7 +15491,7 @@ function onCloseTag(el, end, isImplied = false) {
15504
15491
  }
15505
15492
  }
15506
15493
  }
15507
- if (isCompatEnabled(
15494
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
15508
15495
  "COMPILER_NATIVE_TEMPLATE",
15509
15496
  currentOptions
15510
15497
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -16139,8 +16126,7 @@ function createTransformContext(root, {
16139
16126
  }
16140
16127
  context.parent.children.splice(removalIndex, 1);
16141
16128
  },
16142
- onNodeRemoved: () => {
16143
- },
16129
+ onNodeRemoved: NOOP,
16144
16130
  addIdentifiers(exp) {
16145
16131
  {
16146
16132
  if (isString(exp)) {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @vue/compat v3.4.8
3
+ * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
+ * @license MIT
5
+ **/
1
6
  'use strict';
2
7
 
3
8
  var parser = require('@babel/parser');
@@ -2282,8 +2287,6 @@ function hasPropsChanged(prevProps, nextProps, emitsOptions) {
2282
2287
  return false;
2283
2288
  }
2284
2289
  function updateHOCHostEl({ vnode, parent }, el) {
2285
- if (!el)
2286
- return;
2287
2290
  while (parent) {
2288
2291
  const root = parent.subTree;
2289
2292
  if (root.suspense && root.suspense.activeBranch === vnode) {
@@ -2888,7 +2891,12 @@ function queueEffectWithSuspense(fn, suspense) {
2888
2891
  function setActiveBranch(suspense, branch) {
2889
2892
  suspense.activeBranch = branch;
2890
2893
  const { vnode, parentComponent } = suspense;
2891
- const el = vnode.el = branch.el;
2894
+ let el = branch.el;
2895
+ while (!el && branch.component) {
2896
+ branch = branch.component.subTree;
2897
+ el = branch.el;
2898
+ }
2899
+ vnode.el = el;
2892
2900
  if (parentComponent && parentComponent.subTree === vnode) {
2893
2901
  parentComponent.vnode.el = el;
2894
2902
  updateHOCHostEl(parentComponent, el);
@@ -3137,14 +3145,9 @@ function instanceWatch(source, value, options) {
3137
3145
  cb = value.handler;
3138
3146
  options = value;
3139
3147
  }
3140
- const cur = currentInstance;
3141
- setCurrentInstance(this);
3148
+ const reset = setCurrentInstance(this);
3142
3149
  const res = doWatch(getter, cb.bind(publicThis), options);
3143
- if (cur) {
3144
- setCurrentInstance(cur);
3145
- } else {
3146
- unsetCurrentInstance();
3147
- }
3150
+ reset();
3148
3151
  return res;
3149
3152
  }
3150
3153
  function createPathGetter(ctx, path) {
@@ -3191,11 +3194,10 @@ function traverse(value, depth, currentDepth = 0, seen) {
3191
3194
  }
3192
3195
 
3193
3196
  function withDirectives(vnode, directives) {
3194
- const internalInstance = currentRenderingInstance;
3195
- if (internalInstance === null) {
3197
+ if (currentRenderingInstance === null) {
3196
3198
  return vnode;
3197
3199
  }
3198
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3200
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3199
3201
  const bindings = vnode.dirs || (vnode.dirs = []);
3200
3202
  for (let i = 0; i < directives.length; i++) {
3201
3203
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -3960,9 +3962,9 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
3960
3962
  return;
3961
3963
  }
3962
3964
  pauseTracking();
3963
- setCurrentInstance(target);
3965
+ const reset = setCurrentInstance(target);
3964
3966
  const res = callWithAsyncErrorHandling(hook, target, type, args);
3965
- unsetCurrentInstance();
3967
+ reset();
3966
3968
  resetTracking();
3967
3969
  return res;
3968
3970
  });
@@ -5285,7 +5287,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5285
5287
  return vm;
5286
5288
  }
5287
5289
  }
5288
- Vue.version = `2.6.14-compat:${"3.4.6"}`;
5290
+ Vue.version = `2.6.14-compat:${"3.4.8"}`;
5289
5291
  Vue.config = singletonApp.config;
5290
5292
  Vue.use = (p, ...options) => {
5291
5293
  if (p && isFunction(p.install)) {
@@ -6002,12 +6004,12 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
6002
6004
  if (key in propsDefaults) {
6003
6005
  value = propsDefaults[key];
6004
6006
  } else {
6005
- setCurrentInstance(instance);
6007
+ const reset = setCurrentInstance(instance);
6006
6008
  value = propsDefaults[key] = defaultValue.call(
6007
6009
  isCompatEnabled$1("PROPS_DEFAULT_THIS", instance) ? createPropsDefaultThis(instance, props) : null,
6008
6010
  props
6009
6011
  );
6010
- unsetCurrentInstance();
6012
+ reset();
6011
6013
  }
6012
6014
  } else {
6013
6015
  value = defaultValue;
@@ -8834,9 +8836,7 @@ function createComponentInstance(vnode, parent, suspense) {
8834
8836
  return instance;
8835
8837
  }
8836
8838
  let currentInstance = null;
8837
- const getCurrentInstance = () => {
8838
- return currentInstance || currentRenderingInstance;
8839
- };
8839
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8840
8840
  let internalSetCurrentInstance;
8841
8841
  let setInSSRSetupState;
8842
8842
  {
@@ -8863,8 +8863,13 @@ let setInSSRSetupState;
8863
8863
  );
8864
8864
  }
8865
8865
  const setCurrentInstance = (instance) => {
8866
+ const prev = currentInstance;
8866
8867
  internalSetCurrentInstance(instance);
8867
8868
  instance.scope.on();
8869
+ return () => {
8870
+ instance.scope.off();
8871
+ internalSetCurrentInstance(prev);
8872
+ };
8868
8873
  };
8869
8874
  const unsetCurrentInstance = () => {
8870
8875
  currentInstance && currentInstance.scope.off();
@@ -8891,7 +8896,7 @@ function setupStatefulComponent(instance, isSSR) {
8891
8896
  const { setup } = Component;
8892
8897
  if (setup) {
8893
8898
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
8894
- setCurrentInstance(instance);
8899
+ const reset = setCurrentInstance(instance);
8895
8900
  pauseTracking();
8896
8901
  const setupResult = callWithErrorHandling(
8897
8902
  setup,
@@ -8903,7 +8908,7 @@ function setupStatefulComponent(instance, isSSR) {
8903
8908
  ]
8904
8909
  );
8905
8910
  resetTracking();
8906
- unsetCurrentInstance();
8911
+ reset();
8907
8912
  if (isPromise(setupResult)) {
8908
8913
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
8909
8914
  if (isSSR) {
@@ -8981,13 +8986,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
8981
8986
  }
8982
8987
  }
8983
8988
  if (!skipOptions) {
8984
- setCurrentInstance(instance);
8989
+ const reset = setCurrentInstance(instance);
8985
8990
  pauseTracking();
8986
8991
  try {
8987
8992
  applyOptions(instance);
8988
8993
  } finally {
8989
8994
  resetTracking();
8990
- unsetCurrentInstance();
8995
+ reset();
8991
8996
  }
8992
8997
  }
8993
8998
  }
@@ -9096,7 +9101,7 @@ function isMemoSame(cached, memo) {
9096
9101
  return true;
9097
9102
  }
9098
9103
 
9099
- const version = "3.4.6";
9104
+ const version = "3.4.8";
9100
9105
  const warn$1 = NOOP;
9101
9106
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9102
9107
  const devtools = void 0;
@@ -13006,7 +13011,7 @@ function onCloseTag(el, end, isImplied = false) {
13006
13011
  }
13007
13012
  {
13008
13013
  const props = el.props;
13009
- if (isCompatEnabled(
13014
+ if (!tokenizer.inSFCRoot && isCompatEnabled(
13010
13015
  "COMPILER_NATIVE_TEMPLATE",
13011
13016
  currentOptions
13012
13017
  ) && el.tag === "template" && !isFragmentTemplate(el)) {
@@ -13615,8 +13620,7 @@ function createTransformContext(root, {
13615
13620
  }
13616
13621
  context.parent.children.splice(removalIndex, 1);
13617
13622
  },
13618
- onNodeRemoved: () => {
13619
- },
13623
+ onNodeRemoved: NOOP,
13620
13624
  addIdentifiers(exp) {
13621
13625
  {
13622
13626
  if (isString(exp)) {