@vue/compiler-sfc 2.7.14 → 2.7.15

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.
@@ -248,9 +248,7 @@ const identity = (_) => _;
248
248
  */
249
249
  function genStaticKeys$1(modules) {
250
250
  return modules
251
- .reduce((keys, m) => {
252
- return keys.concat(m.staticKeys || []);
253
- }, [])
251
+ .reduce((keys, m) => keys.concat(m.staticKeys || []), [])
254
252
  .join(',');
255
253
  }
256
254
  /**
@@ -413,7 +411,7 @@ function parseHTML(html, options) {
413
411
  continue;
414
412
  }
415
413
  }
416
- // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
414
+ // https://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
417
415
  if (conditionalComment.test(html)) {
418
416
  const conditionalEnd = html.indexOf(']>');
419
417
  if (conditionalEnd >= 0) {
@@ -3644,7 +3642,7 @@ methodsToPatch.forEach(function (method) {
3644
3642
  });
3645
3643
 
3646
3644
  const arrayKeys = Object.getOwnPropertyNames(arrayMethods);
3647
- const NO_INIITIAL_VALUE = {};
3645
+ const NO_INITIAL_VALUE = {};
3648
3646
  /**
3649
3647
  * In some cases we may want to disable observation inside a component's
3650
3648
  * update computation.
@@ -3701,7 +3699,7 @@ class Observer {
3701
3699
  const keys = Object.keys(value);
3702
3700
  for (let i = 0; i < keys.length; i++) {
3703
3701
  const key = keys[i];
3704
- defineReactive(value, key, NO_INIITIAL_VALUE, undefined, shallow, mock);
3702
+ defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
3705
3703
  }
3706
3704
  }
3707
3705
  }
@@ -3747,7 +3745,7 @@ function defineReactive(obj, key, val, customSetter, shallow, mock) {
3747
3745
  const getter = property && property.get;
3748
3746
  const setter = property && property.set;
3749
3747
  if ((!getter || setter) &&
3750
- (val === NO_INIITIAL_VALUE || arguments.length === 2)) {
3748
+ (val === NO_INITIAL_VALUE || arguments.length === 2)) {
3751
3749
  val = obj[key];
3752
3750
  }
3753
3751
  let childOb = !shallow && observe(val, false, mock);
@@ -4786,7 +4784,7 @@ function deactivateChildComponent(vm, direct) {
4786
4784
  function callHook(vm, hook, args, setContext = true) {
4787
4785
  // #7573 disable dep collection when invoking lifecycle hooks
4788
4786
  pushTarget();
4789
- const prev = currentInstance;
4787
+ const prevInst = currentInstance;
4790
4788
  setContext && setCurrentInstance(vm);
4791
4789
  const handlers = vm.$options[hook];
4792
4790
  const info = `${hook} hook`;
@@ -4798,7 +4796,9 @@ function callHook(vm, hook, args, setContext = true) {
4798
4796
  if (vm._hasHookEvent) {
4799
4797
  vm.$emit('hook:' + hook);
4800
4798
  }
4801
- setContext && setCurrentInstance(prev);
4799
+ if (setContext) {
4800
+ setCurrentInstance(prevInst);
4801
+ }
4802
4802
  popTarget();
4803
4803
  }
4804
4804
 
@@ -8468,7 +8468,10 @@ function compileScript(sfc, options = { id: '' }) {
8468
8468
  }
8469
8469
  }
8470
8470
  if (declId) {
8471
- emitIdentifier = scriptSetup.content.slice(declId.start, declId.end);
8471
+ emitIdentifier =
8472
+ declId.type === 'Identifier'
8473
+ ? declId.name
8474
+ : scriptSetup.content.slice(declId.start, declId.end);
8472
8475
  }
8473
8476
  return true;
8474
8477
  }
@@ -8845,12 +8848,12 @@ function compileScript(sfc, options = { id: '' }) {
8845
8848
  else {
8846
8849
  let start = decl.start + startOffset;
8847
8850
  let end = decl.end + startOffset;
8848
- if (i < total - 1) {
8849
- // not the last one, locate the start of the next
8851
+ if (i === 0) {
8852
+ // first one, locate the start of the next
8850
8853
  end = node.declarations[i + 1].start + startOffset;
8851
8854
  }
8852
8855
  else {
8853
- // last one, locate the end of the prev
8856
+ // not first one, locate the end of the prev
8854
8857
  start = node.declarations[i - 1].end + startOffset;
8855
8858
  }
8856
8859
  s.remove(start, end);
@@ -9024,7 +9027,7 @@ function compileScript(sfc, options = { id: '' }) {
9024
9027
  // we use a default __props so that template expressions referencing props
9025
9028
  // can use it directly
9026
9029
  if (propsIdentifier) {
9027
- s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``}\n`);
9030
+ s.prependLeft(startOffset, `\nconst ${propsIdentifier} = __props${propsTypeDecl ? ` as ${genSetupPropsType(propsTypeDecl)}` : ``};\n`);
9028
9031
  }
9029
9032
  const destructureElements = hasDefineExposeCall ? [`expose`] : [];
9030
9033
  if (emitIdentifier) {
@@ -9578,7 +9581,7 @@ function processExp(exp, isTS, dir) {
9578
9581
  exp = `(${exp})=>{}`;
9579
9582
  }
9580
9583
  else if (dir === 'on') {
9581
- exp = `()=>{${exp}}`;
9584
+ exp = `()=>{return ${exp}}`;
9582
9585
  }
9583
9586
  else if (dir === 'for') {
9584
9587
  const inMatch = exp.match(forAliasRE);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/compiler-sfc",
3
- "version": "2.7.14",
3
+ "version": "2.7.15",
4
4
  "description": "compiler-sfc for Vue 2",
5
5
  "main": "dist/compiler-sfc.js",
6
6
  "types": "dist/compiler-sfc.d.ts",