@vue/compiler-sfc 2.7.7 → 2.7.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.
@@ -3796,7 +3796,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
3796
3796
  // #7981: for accessor properties without setter
3797
3797
  return;
3798
3798
  }
3799
- else if (isRef(value) && !isRef(newVal)) {
3799
+ else if (!shallow && isRef(value) && !isRef(newVal)) {
3800
3800
  value.value = newVal;
3801
3801
  return;
3802
3802
  }
@@ -4610,12 +4610,12 @@ function proxyNormalSlot(slots, key) {
4610
4610
  return () => slots[key];
4611
4611
  }
4612
4612
 
4613
- function syncSetupAttrs(to, from, prev, instance) {
4613
+ function syncSetupProxy(to, from, prev, instance, type) {
4614
4614
  let changed = false;
4615
4615
  for (const key in from) {
4616
4616
  if (!(key in to)) {
4617
4617
  changed = true;
4618
- defineProxyAttr(to, key, instance);
4618
+ defineProxyAttr(to, key, instance, type);
4619
4619
  }
4620
4620
  else if (from[key] !== prev[key]) {
4621
4621
  changed = true;
@@ -4629,12 +4629,12 @@ function syncSetupAttrs(to, from, prev, instance) {
4629
4629
  }
4630
4630
  return changed;
4631
4631
  }
4632
- function defineProxyAttr(proxy, key, instance) {
4632
+ function defineProxyAttr(proxy, key, instance, type) {
4633
4633
  Object.defineProperty(proxy, key, {
4634
4634
  enumerable: true,
4635
4635
  configurable: true,
4636
4636
  get() {
4637
- return instance.$attrs[key];
4637
+ return instance[type][key];
4638
4638
  }
4639
4639
  });
4640
4640
  }
@@ -4714,12 +4714,19 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
4714
4714
  if (vm._attrsProxy) {
4715
4715
  // force update if attrs are accessed and has changed since it may be
4716
4716
  // passed to a child component.
4717
- if (syncSetupAttrs(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm)) {
4717
+ if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
4718
4718
  needsForceUpdate = true;
4719
4719
  }
4720
4720
  }
4721
4721
  vm.$attrs = attrs;
4722
- vm.$listeners = listeners || emptyObject;
4722
+ // update listeners
4723
+ listeners = listeners || emptyObject;
4724
+ const prevListeners = vm.$options._parentListeners;
4725
+ if (vm._listenersProxy) {
4726
+ syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
4727
+ }
4728
+ vm.$listeners = vm.$options._parentListeners = listeners;
4729
+ updateComponentListeners(vm, listeners, prevListeners);
4723
4730
  // update props
4724
4731
  if (propsData && vm.$options.props) {
4725
4732
  toggleObserving(false);
@@ -4734,11 +4741,6 @@ function updateChildComponent(vm, propsData, listeners, parentVnode, renderChild
4734
4741
  // keep a copy of raw propsData
4735
4742
  vm.$options.propsData = propsData;
4736
4743
  }
4737
- // update listeners
4738
- listeners = listeners || emptyObject;
4739
- const oldListeners = vm.$options._parentListeners;
4740
- vm.$options._parentListeners = listeners;
4741
- updateComponentListeners(vm, listeners, oldListeners);
4742
4744
  // resolve slots + force update if has children
4743
4745
  if (needsForceUpdate) {
4744
4746
  vm.$slots = resolveSlots(renderChildren, parentVnode.context);
@@ -12006,10 +12008,7 @@ function genElement(el, state) {
12006
12008
  // check if this is a component in <script setup>
12007
12009
  const bindings = state.options.bindings;
12008
12010
  if (maybeComponent && bindings && bindings.__isScriptSetup !== false) {
12009
- tag =
12010
- checkBindingType(bindings, el.tag) ||
12011
- checkBindingType(bindings, camelize(el.tag)) ||
12012
- checkBindingType(bindings, capitalize(camelize(el.tag)));
12011
+ tag = checkBindingType(bindings, el.tag);
12013
12012
  }
12014
12013
  if (!tag)
12015
12014
  tag = `'${el.tag}'`;
@@ -12026,9 +12025,29 @@ function genElement(el, state) {
12026
12025
  }
12027
12026
  }
12028
12027
  function checkBindingType(bindings, key) {
12029
- const type = bindings[key];
12030
- if (type && type.startsWith('setup')) {
12031
- return key;
12028
+ const camelName = camelize(key);
12029
+ const PascalName = capitalize(camelName);
12030
+ const checkType = (type) => {
12031
+ if (bindings[key] === type) {
12032
+ return key;
12033
+ }
12034
+ if (bindings[camelName] === type) {
12035
+ return camelName;
12036
+ }
12037
+ if (bindings[PascalName] === type) {
12038
+ return PascalName;
12039
+ }
12040
+ };
12041
+ const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) ||
12042
+ checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */);
12043
+ if (fromConst) {
12044
+ return fromConst;
12045
+ }
12046
+ const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) ||
12047
+ checkType("setup-ref" /* BindingTypes.SETUP_REF */) ||
12048
+ checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */);
12049
+ if (fromMaybeRef) {
12050
+ return fromMaybeRef;
12032
12051
  }
12033
12052
  }
12034
12053
  // hoist static sub-trees out
@@ -13246,8 +13265,7 @@ function actuallyCompile(options) {
13246
13265
  };
13247
13266
  }
13248
13267
  else {
13249
- // transpile code with vue-template-es2015-compiler, which is a forked
13250
- // version of Buble that applies ES2015 transforms + stripping `with` usage
13268
+ // stripping `with` usage
13251
13269
  let code = `var __render__ = ${prefixIdentifiers(`function render(${isFunctional ? `_c,_vm` : ``}){${render}\n}`, isFunctional, isTS, transpileOptions, bindings)}\n` +
13252
13270
  `var __staticRenderFns__ = [${staticRenderFns.map(code => prefixIdentifiers(`function (${isFunctional ? `_c,_vm` : ``}){${code}\n}`, isFunctional, isTS, transpileOptions, bindings))}]` +
13253
13271
  `\n`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "2.7.7",
3
+ "version": "2.7.8",
4
4
  "description": "compiler-sfc for Vue 2",
5
5
  "main": "dist/compiler-sfc.js",
6
6
  "types": "dist/compiler-sfc.d.ts",
@@ -29,7 +29,6 @@
29
29
  "postcss-selector-parser": "^6.0.10",
30
30
  "pug": "^3.0.2",
31
31
  "sass": "^1.52.3",
32
- "stylus": "^0.58.1",
33
- "vue-template-es2015-compiler": "^1.9.1"
32
+ "stylus": "^0.58.1"
34
33
  }
35
34
  }