vue 2.6.8 → 2.6.12

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.
Files changed (42) hide show
  1. package/README.md +61 -81
  2. package/dist/README.md +3 -5
  3. package/dist/vue.common.dev.js +97 -44
  4. package/dist/vue.common.prod.js +3 -3
  5. package/dist/vue.esm.browser.js +97 -44
  6. package/dist/vue.esm.browser.min.js +3 -3
  7. package/dist/vue.esm.js +97 -44
  8. package/dist/vue.js +97 -44
  9. package/dist/vue.min.js +3 -3
  10. package/dist/vue.runtime.common.dev.js +73 -35
  11. package/dist/vue.runtime.common.prod.js +3 -3
  12. package/dist/vue.runtime.esm.js +73 -35
  13. package/dist/vue.runtime.js +73 -35
  14. package/dist/vue.runtime.min.js +3 -3
  15. package/package.json +4 -4
  16. package/src/compiler/codegen/events.js +1 -1
  17. package/src/compiler/error-detector.js +18 -3
  18. package/src/compiler/parser/html-parser.js +2 -2
  19. package/src/compiler/parser/index.js +5 -5
  20. package/src/core/instance/proxy.js +1 -1
  21. package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
  22. package/src/core/instance/render-helpers/bind-object-props.js +5 -3
  23. package/src/core/instance/render.js +1 -1
  24. package/src/core/observer/scheduler.js +17 -6
  25. package/src/core/util/env.js +1 -2
  26. package/src/core/util/error.js +4 -3
  27. package/src/core/util/next-tick.js +1 -1
  28. package/src/core/vdom/create-element.js +6 -0
  29. package/src/core/vdom/helpers/normalize-scoped-slots.js +9 -4
  30. package/src/core/vdom/helpers/resolve-async-component.js +16 -4
  31. package/src/core/vdom/patch.js +4 -4
  32. package/src/platforms/web/compiler/modules/model.js +1 -1
  33. package/src/platforms/web/runtime/modules/dom-props.js +3 -2
  34. package/src/platforms/web/runtime/modules/events.js +4 -2
  35. package/src/platforms/web/runtime/modules/transition.js +1 -1
  36. package/src/platforms/web/server/util.js +4 -4
  37. package/src/server/template-renderer/create-async-file-mapper.js +2 -2
  38. package/types/index.d.ts +1 -2
  39. package/types/options.d.ts +3 -3
  40. package/types/umd.d.ts +48 -0
  41. package/types/vnode.d.ts +1 -1
  42. package/types/vue.d.ts +1 -1
package/dist/vue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Vue.js v2.6.8
3
- * (c) 2014-2019 Evan You
2
+ * Vue.js v2.6.12
3
+ * (c) 2014-2020 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -1861,10 +1861,11 @@
1861
1861
  var res;
1862
1862
  try {
1863
1863
  res = args ? handler.apply(context, args) : handler.call(context);
1864
- if (res && !res._isVue && isPromise(res)) {
1864
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1865
+ res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1865
1866
  // issue #9511
1866
- // reassign to res to avoid catch triggering multiple times when nested calls
1867
- res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1867
+ // avoid catch triggering multiple times when nested calls
1868
+ res._handled = true;
1868
1869
  }
1869
1870
  } catch (e) {
1870
1871
  handleError(e, vm, info);
@@ -1968,7 +1969,7 @@
1968
1969
  isUsingMicroTask = true;
1969
1970
  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1970
1971
  // Fallback to setImmediate.
1971
- // Techinically it leverages the (macro) task queue,
1972
+ // Technically it leverages the (macro) task queue,
1972
1973
  // but it is still a better choice than setTimeout.
1973
1974
  timerFunc = function () {
1974
1975
  setImmediate(flushCallbacks);
@@ -2057,7 +2058,7 @@
2057
2058
  warn(
2058
2059
  "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2059
2060
  'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2060
- 'prevent conflicts with Vue internals' +
2061
+ 'prevent conflicts with Vue internals. ' +
2061
2062
  'See: https://vuejs.org/v2/api/#data',
2062
2063
  target
2063
2064
  );
@@ -2547,7 +2548,8 @@
2547
2548
  prevSlots
2548
2549
  ) {
2549
2550
  var res;
2550
- var isStable = slots ? !!slots.$stable : true;
2551
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2552
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2551
2553
  var key = slots && slots.$key;
2552
2554
  if (!slots) {
2553
2555
  res = {};
@@ -2559,7 +2561,8 @@
2559
2561
  prevSlots &&
2560
2562
  prevSlots !== emptyObject &&
2561
2563
  key === prevSlots.$key &&
2562
- Object.keys(normalSlots).length === 0
2564
+ !hasNormalSlots &&
2565
+ !prevSlots.$hasNormal
2563
2566
  ) {
2564
2567
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2565
2568
  // only need to normalize once
@@ -2585,6 +2588,7 @@
2585
2588
  }
2586
2589
  def(res, '$stable', isStable);
2587
2590
  def(res, '$key', key);
2591
+ def(res, '$hasNormal', hasNormalSlots);
2588
2592
  return res
2589
2593
  }
2590
2594
 
@@ -2594,8 +2598,10 @@
2594
2598
  res = res && typeof res === 'object' && !Array.isArray(res)
2595
2599
  ? [res] // single vnode
2596
2600
  : normalizeChildren(res);
2597
- return res && res.length === 0
2598
- ? undefined
2601
+ return res && (
2602
+ res.length === 0 ||
2603
+ (res.length === 1 && res[0].isComment) // #9658
2604
+ ) ? undefined
2599
2605
  : res
2600
2606
  };
2601
2607
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2775,12 +2781,13 @@
2775
2781
  : data.attrs || (data.attrs = {});
2776
2782
  }
2777
2783
  var camelizedKey = camelize(key);
2778
- if (!(key in hash) && !(camelizedKey in hash)) {
2784
+ var hyphenatedKey = hyphenate(key);
2785
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2779
2786
  hash[key] = value[key];
2780
2787
 
2781
2788
  if (isSync) {
2782
2789
  var on = data.on || (data.on = {});
2783
- on[("update:" + camelizedKey)] = function ($event) {
2790
+ on[("update:" + key)] = function ($event) {
2784
2791
  value[key] = $event;
2785
2792
  };
2786
2793
  }
@@ -2911,7 +2918,7 @@
2911
2918
  if (typeof key === 'string' && key) {
2912
2919
  baseObj[values[i]] = values[i + 1];
2913
2920
  } else if (key !== '' && key !== null) {
2914
- // null is a speical value for explicitly removing a binding
2921
+ // null is a special value for explicitly removing a binding
2915
2922
  warn(
2916
2923
  ("Invalid value for dynamic directive argument (expected string or null): " + key),
2917
2924
  this
@@ -3406,6 +3413,12 @@
3406
3413
  ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3407
3414
  if (config.isReservedTag(tag)) {
3408
3415
  // platform built-in elements
3416
+ if (isDef(data) && isDef(data.nativeOn)) {
3417
+ warn(
3418
+ ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3419
+ context
3420
+ );
3421
+ }
3409
3422
  vnode = new VNode(
3410
3423
  config.parsePlatformTagName(tag), data, children,
3411
3424
  undefined, undefined, context
@@ -3531,7 +3544,7 @@
3531
3544
  // render self
3532
3545
  var vnode;
3533
3546
  try {
3534
- // There's no need to maintain a stack becaues all render fns are called
3547
+ // There's no need to maintain a stack because all render fns are called
3535
3548
  // separately from one another. Nested component's render fns are called
3536
3549
  // when parent component is patched.
3537
3550
  currentRenderingInstance = vm;
@@ -3615,7 +3628,7 @@
3615
3628
  }
3616
3629
 
3617
3630
  var owner = currentRenderingInstance;
3618
- if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3631
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3619
3632
  // already pending
3620
3633
  factory.owners.push(owner);
3621
3634
  }
@@ -3624,9 +3637,11 @@
3624
3637
  return factory.loadingComp
3625
3638
  }
3626
3639
 
3627
- if (!isDef(factory.owners)) {
3640
+ if (owner && !isDef(factory.owners)) {
3628
3641
  var owners = factory.owners = [owner];
3629
- var sync = true
3642
+ var sync = true;
3643
+ var timerLoading = null;
3644
+ var timerTimeout = null
3630
3645
 
3631
3646
  ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3632
3647
 
@@ -3637,6 +3652,14 @@
3637
3652
 
3638
3653
  if (renderCompleted) {
3639
3654
  owners.length = 0;
3655
+ if (timerLoading !== null) {
3656
+ clearTimeout(timerLoading);
3657
+ timerLoading = null;
3658
+ }
3659
+ if (timerTimeout !== null) {
3660
+ clearTimeout(timerTimeout);
3661
+ timerTimeout = null;
3662
+ }
3640
3663
  }
3641
3664
  };
3642
3665
 
@@ -3683,7 +3706,8 @@
3683
3706
  if (res.delay === 0) {
3684
3707
  factory.loading = true;
3685
3708
  } else {
3686
- setTimeout(function () {
3709
+ timerLoading = setTimeout(function () {
3710
+ timerLoading = null;
3687
3711
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3688
3712
  factory.loading = true;
3689
3713
  forceRender(false);
@@ -3693,7 +3717,8 @@
3693
3717
  }
3694
3718
 
3695
3719
  if (isDef(res.timeout)) {
3696
- setTimeout(function () {
3720
+ timerTimeout = setTimeout(function () {
3721
+ timerTimeout = null;
3697
3722
  if (isUndef(factory.resolved)) {
3698
3723
  reject(
3699
3724
  "timeout (" + (res.timeout) + "ms)"
@@ -4239,11 +4264,21 @@
4239
4264
  // timestamp can either be hi-res (relative to page load) or low-res
4240
4265
  // (relative to UNIX epoch), so in order to compare time we have to use the
4241
4266
  // same timestamp type when saving the flush timestamp.
4242
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4243
- // if the low-res timestamp which is bigger than the event timestamp
4244
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4245
- // and we need to use the hi-res version for event listeners as well.
4246
- getNow = function () { return performance.now(); };
4267
+ // All IE versions use low-res event timestamps, and have problematic clock
4268
+ // implementations (#9632)
4269
+ if (inBrowser && !isIE) {
4270
+ var performance = window.performance;
4271
+ if (
4272
+ performance &&
4273
+ typeof performance.now === 'function' &&
4274
+ getNow() > document.createEvent('Event').timeStamp
4275
+ ) {
4276
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4277
+ // smaller than it, it means the event is using a hi-res timestamp,
4278
+ // and we need to use the hi-res version for event listener timestamps as
4279
+ // well.
4280
+ getNow = function () { return performance.now(); };
4281
+ }
4247
4282
  }
4248
4283
 
4249
4284
  /**
@@ -5408,7 +5443,7 @@
5408
5443
  value: FunctionalRenderContext
5409
5444
  });
5410
5445
 
5411
- Vue.version = '2.6.8';
5446
+ Vue.version = '2.6.12';
5412
5447
 
5413
5448
  /* */
5414
5449
 
@@ -6081,7 +6116,7 @@
6081
6116
  }
6082
6117
  }
6083
6118
 
6084
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6119
+ function removeVnodes (vnodes, startIdx, endIdx) {
6085
6120
  for (; startIdx <= endIdx; ++startIdx) {
6086
6121
  var ch = vnodes[startIdx];
6087
6122
  if (isDef(ch)) {
@@ -6192,7 +6227,7 @@
6192
6227
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6193
6228
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6194
6229
  } else if (newStartIdx > newEndIdx) {
6195
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6230
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6196
6231
  }
6197
6232
  }
6198
6233
 
@@ -6284,7 +6319,7 @@
6284
6319
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6285
6320
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6286
6321
  } else if (isDef(oldCh)) {
6287
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6322
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6288
6323
  } else if (isDef(oldVnode.text)) {
6289
6324
  nodeOps.setTextContent(elm, '');
6290
6325
  }
@@ -6513,7 +6548,7 @@
6513
6548
 
6514
6549
  // destroy old node
6515
6550
  if (isDef(parentElm)) {
6516
- removeVnodes(parentElm, [oldVnode], 0, 0);
6551
+ removeVnodes([oldVnode], 0, 0);
6517
6552
  } else if (isDef(oldVnode.tag)) {
6518
6553
  invokeDestroyHook(oldVnode);
6519
6554
  }
@@ -7500,8 +7535,10 @@
7500
7535
  e.target === e.currentTarget ||
7501
7536
  // event is fired after handler attachment
7502
7537
  e.timeStamp >= attachedTimestamp ||
7503
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
7504
- e.timeStamp === 0 ||
7538
+ // bail for environments that have buggy event.timeStamp implementations
7539
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7540
+ // #9681 QtWebEngine event.timeStamp is negative value
7541
+ e.timeStamp <= 0 ||
7505
7542
  // #9448 bail if event is fired in another document in a multi-page
7506
7543
  // electron/nw.js app, since event.timeStamp will be using a different
7507
7544
  // starting reference
@@ -7568,10 +7605,11 @@
7568
7605
  }
7569
7606
 
7570
7607
  for (key in oldProps) {
7571
- if (isUndef(props[key])) {
7608
+ if (!(key in props)) {
7572
7609
  elm[key] = '';
7573
7610
  }
7574
7611
  }
7612
+
7575
7613
  for (key in props) {
7576
7614
  cur = props[key];
7577
7615
  // ignore children if the node has textContent or innerHTML,
@@ -7611,7 +7649,7 @@
7611
7649
  // skip the update if old and new VDOM state is the same.
7612
7650
  // `value` is handled separately because the DOM value may be temporarily
7613
7651
  // out of sync with VDOM state due to focus, composition and modifiers.
7614
- // This #4521 by skipping the unnecesarry `checked` update.
7652
+ // This #4521 by skipping the unnecessary `checked` update.
7615
7653
  cur !== oldProps[key]
7616
7654
  ) {
7617
7655
  // some property updates can throw
@@ -8119,8 +8157,8 @@
8119
8157
  var context = activeInstance;
8120
8158
  var transitionNode = activeInstance.$vnode;
8121
8159
  while (transitionNode && transitionNode.parent) {
8122
- transitionNode = transitionNode.parent;
8123
8160
  context = transitionNode.context;
8161
+ transitionNode = transitionNode.parent;
8124
8162
  }
8125
8163
 
8126
8164
  var isAppear = !context._isMounted || !vnode.isRootInsert;
@@ -9216,7 +9254,7 @@
9216
9254
  var startTagClose = /^\s*(\/?)>/;
9217
9255
  var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9218
9256
  var doctype = /^<!DOCTYPE [^>]+>/i;
9219
- // #7298: escape - to avoid being pased as HTML comment when inlined in page
9257
+ // #7298: escape - to avoid being passed as HTML comment when inlined in page
9220
9258
  var comment = /^<!\--/;
9221
9259
  var conditionalComment = /^<!\[/;
9222
9260
 
@@ -9501,7 +9539,7 @@
9501
9539
  /* */
9502
9540
 
9503
9541
  var onRE = /^@|^v-on:/;
9504
- var dirRE = /^v-|^@|^:/;
9542
+ var dirRE = /^v-|^@|^:|^#/;
9505
9543
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9506
9544
  var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9507
9545
  var stripParensRE = /^\(|\)$/g;
@@ -9827,7 +9865,7 @@
9827
9865
  text = preserveWhitespace ? ' ' : '';
9828
9866
  }
9829
9867
  if (text) {
9830
- if (whitespaceOption === 'condense') {
9868
+ if (!inPre && whitespaceOption === 'condense') {
9831
9869
  // condense consecutive whitespaces into single space
9832
9870
  text = text.replace(whitespaceRE$1, ' ');
9833
9871
  }
@@ -9856,7 +9894,7 @@
9856
9894
  }
9857
9895
  },
9858
9896
  comment: function comment (text, start, end) {
9859
- // adding anyting as a sibling to the root node is forbidden
9897
+ // adding anything as a sibling to the root node is forbidden
9860
9898
  // comments should still be allowed, but ignored
9861
9899
  if (currentParent) {
9862
9900
  var child = {
@@ -10125,7 +10163,7 @@
10125
10163
  if (el.parent && !maybeComponent(el.parent)) {
10126
10164
  warn$2(
10127
10165
  "<template v-slot> can only appear at the root level inside " +
10128
- "the receiving the component",
10166
+ "the receiving component",
10129
10167
  el
10130
10168
  );
10131
10169
  }
@@ -10688,7 +10726,7 @@
10688
10726
 
10689
10727
  /* */
10690
10728
 
10691
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10729
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10692
10730
  var fnInvokeRE = /\([^)]*?\);*$/;
10693
10731
  var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10694
10732
 
@@ -11457,6 +11495,8 @@
11457
11495
  var range = node.rawAttrsMap[name];
11458
11496
  if (name === 'v-for') {
11459
11497
  checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11498
+ } else if (name === 'v-slot' || name[0] === '#') {
11499
+ checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
11460
11500
  } else if (onRE.test(name)) {
11461
11501
  checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11462
11502
  } else {
@@ -11476,9 +11516,9 @@
11476
11516
  }
11477
11517
 
11478
11518
  function checkEvent (exp, text, warn, range) {
11479
- var stipped = exp.replace(stripStringRE, '');
11480
- var keywordMatch = stipped.match(unaryOperatorsRE);
11481
- if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11519
+ var stripped = exp.replace(stripStringRE, '');
11520
+ var keywordMatch = stripped.match(unaryOperatorsRE);
11521
+ if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11482
11522
  warn(
11483
11523
  "avoid using JavaScript unary operator as property name: " +
11484
11524
  "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
@@ -11533,6 +11573,19 @@
11533
11573
  }
11534
11574
  }
11535
11575
 
11576
+ function checkFunctionParameterExpression (exp, text, warn, range) {
11577
+ try {
11578
+ new Function(exp, '');
11579
+ } catch (e) {
11580
+ warn(
11581
+ "invalid function parameter expression: " + (e.message) + " in\n\n" +
11582
+ " " + exp + "\n\n" +
11583
+ " Raw expression: " + (text.trim()) + "\n",
11584
+ range
11585
+ );
11586
+ }
11587
+ }
11588
+
11536
11589
  /* */
11537
11590
 
11538
11591
  var range = 2;