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
@@ -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
  'use strict';
@@ -1857,10 +1857,11 @@ function invokeWithErrorHandling (
1857
1857
  var res;
1858
1858
  try {
1859
1859
  res = args ? handler.apply(context, args) : handler.call(context);
1860
- if (res && !res._isVue && isPromise(res)) {
1860
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1861
+ res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1861
1862
  // issue #9511
1862
- // reassign to res to avoid catch triggering multiple times when nested calls
1863
- res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1863
+ // avoid catch triggering multiple times when nested calls
1864
+ res._handled = true;
1864
1865
  }
1865
1866
  } catch (e) {
1866
1867
  handleError(e, vm, info);
@@ -1964,7 +1965,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
1964
1965
  isUsingMicroTask = true;
1965
1966
  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1966
1967
  // Fallback to setImmediate.
1967
- // Techinically it leverages the (macro) task queue,
1968
+ // Technically it leverages the (macro) task queue,
1968
1969
  // but it is still a better choice than setTimeout.
1969
1970
  timerFunc = function () {
1970
1971
  setImmediate(flushCallbacks);
@@ -2053,7 +2054,7 @@ var initProxy;
2053
2054
  warn(
2054
2055
  "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2055
2056
  'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2056
- 'prevent conflicts with Vue internals' +
2057
+ 'prevent conflicts with Vue internals. ' +
2057
2058
  'See: https://vuejs.org/v2/api/#data',
2058
2059
  target
2059
2060
  );
@@ -2543,7 +2544,8 @@ function normalizeScopedSlots (
2543
2544
  prevSlots
2544
2545
  ) {
2545
2546
  var res;
2546
- var isStable = slots ? !!slots.$stable : true;
2547
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2548
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2547
2549
  var key = slots && slots.$key;
2548
2550
  if (!slots) {
2549
2551
  res = {};
@@ -2555,7 +2557,8 @@ function normalizeScopedSlots (
2555
2557
  prevSlots &&
2556
2558
  prevSlots !== emptyObject &&
2557
2559
  key === prevSlots.$key &&
2558
- Object.keys(normalSlots).length === 0
2560
+ !hasNormalSlots &&
2561
+ !prevSlots.$hasNormal
2559
2562
  ) {
2560
2563
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2561
2564
  // only need to normalize once
@@ -2581,6 +2584,7 @@ function normalizeScopedSlots (
2581
2584
  }
2582
2585
  def(res, '$stable', isStable);
2583
2586
  def(res, '$key', key);
2587
+ def(res, '$hasNormal', hasNormalSlots);
2584
2588
  return res
2585
2589
  }
2586
2590
 
@@ -2590,8 +2594,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2590
2594
  res = res && typeof res === 'object' && !Array.isArray(res)
2591
2595
  ? [res] // single vnode
2592
2596
  : normalizeChildren(res);
2593
- return res && res.length === 0
2594
- ? undefined
2597
+ return res && (
2598
+ res.length === 0 ||
2599
+ (res.length === 1 && res[0].isComment) // #9658
2600
+ ) ? undefined
2595
2601
  : res
2596
2602
  };
2597
2603
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2771,12 +2777,13 @@ function bindObjectProps (
2771
2777
  : data.attrs || (data.attrs = {});
2772
2778
  }
2773
2779
  var camelizedKey = camelize(key);
2774
- if (!(key in hash) && !(camelizedKey in hash)) {
2780
+ var hyphenatedKey = hyphenate(key);
2781
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2775
2782
  hash[key] = value[key];
2776
2783
 
2777
2784
  if (isSync) {
2778
2785
  var on = data.on || (data.on = {});
2779
- on[("update:" + camelizedKey)] = function ($event) {
2786
+ on[("update:" + key)] = function ($event) {
2780
2787
  value[key] = $event;
2781
2788
  };
2782
2789
  }
@@ -2907,7 +2914,7 @@ function bindDynamicKeys (baseObj, values) {
2907
2914
  if (typeof key === 'string' && key) {
2908
2915
  baseObj[values[i]] = values[i + 1];
2909
2916
  } else if (key !== '' && key !== null) {
2910
- // null is a speical value for explicitly removing a binding
2917
+ // null is a special value for explicitly removing a binding
2911
2918
  warn(
2912
2919
  ("Invalid value for dynamic directive argument (expected string or null): " + key),
2913
2920
  this
@@ -3402,6 +3409,12 @@ function _createElement (
3402
3409
  ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3403
3410
  if (config.isReservedTag(tag)) {
3404
3411
  // platform built-in elements
3412
+ if (isDef(data) && isDef(data.nativeOn)) {
3413
+ warn(
3414
+ ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3415
+ context
3416
+ );
3417
+ }
3405
3418
  vnode = new VNode(
3406
3419
  config.parsePlatformTagName(tag), data, children,
3407
3420
  undefined, undefined, context
@@ -3527,7 +3540,7 @@ function renderMixin (Vue) {
3527
3540
  // render self
3528
3541
  var vnode;
3529
3542
  try {
3530
- // There's no need to maintain a stack becaues all render fns are called
3543
+ // There's no need to maintain a stack because all render fns are called
3531
3544
  // separately from one another. Nested component's render fns are called
3532
3545
  // when parent component is patched.
3533
3546
  currentRenderingInstance = vm;
@@ -3611,7 +3624,7 @@ function resolveAsyncComponent (
3611
3624
  }
3612
3625
 
3613
3626
  var owner = currentRenderingInstance;
3614
- if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3627
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3615
3628
  // already pending
3616
3629
  factory.owners.push(owner);
3617
3630
  }
@@ -3620,9 +3633,11 @@ function resolveAsyncComponent (
3620
3633
  return factory.loadingComp
3621
3634
  }
3622
3635
 
3623
- if (!isDef(factory.owners)) {
3636
+ if (owner && !isDef(factory.owners)) {
3624
3637
  var owners = factory.owners = [owner];
3625
- var sync = true
3638
+ var sync = true;
3639
+ var timerLoading = null;
3640
+ var timerTimeout = null
3626
3641
 
3627
3642
  ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3628
3643
 
@@ -3633,6 +3648,14 @@ function resolveAsyncComponent (
3633
3648
 
3634
3649
  if (renderCompleted) {
3635
3650
  owners.length = 0;
3651
+ if (timerLoading !== null) {
3652
+ clearTimeout(timerLoading);
3653
+ timerLoading = null;
3654
+ }
3655
+ if (timerTimeout !== null) {
3656
+ clearTimeout(timerTimeout);
3657
+ timerTimeout = null;
3658
+ }
3636
3659
  }
3637
3660
  };
3638
3661
 
@@ -3679,7 +3702,8 @@ function resolveAsyncComponent (
3679
3702
  if (res.delay === 0) {
3680
3703
  factory.loading = true;
3681
3704
  } else {
3682
- setTimeout(function () {
3705
+ timerLoading = setTimeout(function () {
3706
+ timerLoading = null;
3683
3707
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3684
3708
  factory.loading = true;
3685
3709
  forceRender(false);
@@ -3689,7 +3713,8 @@ function resolveAsyncComponent (
3689
3713
  }
3690
3714
 
3691
3715
  if (isDef(res.timeout)) {
3692
- setTimeout(function () {
3716
+ timerTimeout = setTimeout(function () {
3717
+ timerTimeout = null;
3693
3718
  if (isUndef(factory.resolved)) {
3694
3719
  reject(
3695
3720
  "timeout (" + (res.timeout) + "ms)"
@@ -4235,11 +4260,21 @@ var getNow = Date.now;
4235
4260
  // timestamp can either be hi-res (relative to page load) or low-res
4236
4261
  // (relative to UNIX epoch), so in order to compare time we have to use the
4237
4262
  // same timestamp type when saving the flush timestamp.
4238
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4239
- // if the low-res timestamp which is bigger than the event timestamp
4240
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4241
- // and we need to use the hi-res version for event listeners as well.
4242
- getNow = function () { return performance.now(); };
4263
+ // All IE versions use low-res event timestamps, and have problematic clock
4264
+ // implementations (#9632)
4265
+ if (inBrowser && !isIE) {
4266
+ var performance = window.performance;
4267
+ if (
4268
+ performance &&
4269
+ typeof performance.now === 'function' &&
4270
+ getNow() > document.createEvent('Event').timeStamp
4271
+ ) {
4272
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4273
+ // smaller than it, it means the event is using a hi-res timestamp,
4274
+ // and we need to use the hi-res version for event listener timestamps as
4275
+ // well.
4276
+ getNow = function () { return performance.now(); };
4277
+ }
4243
4278
  }
4244
4279
 
4245
4280
  /**
@@ -5404,7 +5439,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5404
5439
  value: FunctionalRenderContext
5405
5440
  });
5406
5441
 
5407
- Vue.version = '2.6.8';
5442
+ Vue.version = '2.6.12';
5408
5443
 
5409
5444
  /* */
5410
5445
 
@@ -6077,7 +6112,7 @@ function createPatchFunction (backend) {
6077
6112
  }
6078
6113
  }
6079
6114
 
6080
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6115
+ function removeVnodes (vnodes, startIdx, endIdx) {
6081
6116
  for (; startIdx <= endIdx; ++startIdx) {
6082
6117
  var ch = vnodes[startIdx];
6083
6118
  if (isDef(ch)) {
@@ -6188,7 +6223,7 @@ function createPatchFunction (backend) {
6188
6223
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6189
6224
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6190
6225
  } else if (newStartIdx > newEndIdx) {
6191
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6226
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6192
6227
  }
6193
6228
  }
6194
6229
 
@@ -6280,7 +6315,7 @@ function createPatchFunction (backend) {
6280
6315
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6281
6316
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6282
6317
  } else if (isDef(oldCh)) {
6283
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6318
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6284
6319
  } else if (isDef(oldVnode.text)) {
6285
6320
  nodeOps.setTextContent(elm, '');
6286
6321
  }
@@ -6509,7 +6544,7 @@ function createPatchFunction (backend) {
6509
6544
 
6510
6545
  // destroy old node
6511
6546
  if (isDef(parentElm)) {
6512
- removeVnodes(parentElm, [oldVnode], 0, 0);
6547
+ removeVnodes([oldVnode], 0, 0);
6513
6548
  } else if (isDef(oldVnode.tag)) {
6514
6549
  invokeDestroyHook(oldVnode);
6515
6550
  }
@@ -7496,8 +7531,10 @@ function add$1 (
7496
7531
  e.target === e.currentTarget ||
7497
7532
  // event is fired after handler attachment
7498
7533
  e.timeStamp >= attachedTimestamp ||
7499
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
7500
- e.timeStamp === 0 ||
7534
+ // bail for environments that have buggy event.timeStamp implementations
7535
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7536
+ // #9681 QtWebEngine event.timeStamp is negative value
7537
+ e.timeStamp <= 0 ||
7501
7538
  // #9448 bail if event is fired in another document in a multi-page
7502
7539
  // electron/nw.js app, since event.timeStamp will be using a different
7503
7540
  // starting reference
@@ -7564,10 +7601,11 @@ function updateDOMProps (oldVnode, vnode) {
7564
7601
  }
7565
7602
 
7566
7603
  for (key in oldProps) {
7567
- if (isUndef(props[key])) {
7604
+ if (!(key in props)) {
7568
7605
  elm[key] = '';
7569
7606
  }
7570
7607
  }
7608
+
7571
7609
  for (key in props) {
7572
7610
  cur = props[key];
7573
7611
  // ignore children if the node has textContent or innerHTML,
@@ -7607,7 +7645,7 @@ function updateDOMProps (oldVnode, vnode) {
7607
7645
  // skip the update if old and new VDOM state is the same.
7608
7646
  // `value` is handled separately because the DOM value may be temporarily
7609
7647
  // out of sync with VDOM state due to focus, composition and modifiers.
7610
- // This #4521 by skipping the unnecesarry `checked` update.
7648
+ // This #4521 by skipping the unnecessary `checked` update.
7611
7649
  cur !== oldProps[key]
7612
7650
  ) {
7613
7651
  // some property updates can throw
@@ -8115,8 +8153,8 @@ function enter (vnode, toggleDisplay) {
8115
8153
  var context = activeInstance;
8116
8154
  var transitionNode = activeInstance.$vnode;
8117
8155
  while (transitionNode && transitionNode.parent) {
8118
- transitionNode = transitionNode.parent;
8119
8156
  context = transitionNode.context;
8157
+ transitionNode = transitionNode.parent;
8120
8158
  }
8121
8159
 
8122
8160
  var isAppear = !context._isMounted || !vnode.isRootInsert;
@@ -9212,7 +9250,7 @@ var startTagOpen = new RegExp(("^<" + qnameCapture));
9212
9250
  var startTagClose = /^\s*(\/?)>/;
9213
9251
  var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9214
9252
  var doctype = /^<!DOCTYPE [^>]+>/i;
9215
- // #7298: escape - to avoid being pased as HTML comment when inlined in page
9253
+ // #7298: escape - to avoid being passed as HTML comment when inlined in page
9216
9254
  var comment = /^<!\--/;
9217
9255
  var conditionalComment = /^<!\[/;
9218
9256
 
@@ -9497,7 +9535,7 @@ function parseHTML (html, options) {
9497
9535
  /* */
9498
9536
 
9499
9537
  var onRE = /^@|^v-on:/;
9500
- var dirRE = /^v-|^@|^:/;
9538
+ var dirRE = /^v-|^@|^:|^#/;
9501
9539
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9502
9540
  var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9503
9541
  var stripParensRE = /^\(|\)$/g;
@@ -9823,7 +9861,7 @@ function parse (
9823
9861
  text = preserveWhitespace ? ' ' : '';
9824
9862
  }
9825
9863
  if (text) {
9826
- if (whitespaceOption === 'condense') {
9864
+ if (!inPre && whitespaceOption === 'condense') {
9827
9865
  // condense consecutive whitespaces into single space
9828
9866
  text = text.replace(whitespaceRE$1, ' ');
9829
9867
  }
@@ -9852,7 +9890,7 @@ function parse (
9852
9890
  }
9853
9891
  },
9854
9892
  comment: function comment (text, start, end) {
9855
- // adding anyting as a sibling to the root node is forbidden
9893
+ // adding anything as a sibling to the root node is forbidden
9856
9894
  // comments should still be allowed, but ignored
9857
9895
  if (currentParent) {
9858
9896
  var child = {
@@ -10121,7 +10159,7 @@ function processSlotContent (el) {
10121
10159
  if (el.parent && !maybeComponent(el.parent)) {
10122
10160
  warn$2(
10123
10161
  "<template v-slot> can only appear at the root level inside " +
10124
- "the receiving the component",
10162
+ "the receiving component",
10125
10163
  el
10126
10164
  );
10127
10165
  }
@@ -10684,7 +10722,7 @@ function isDirectChildOfTemplateFor (node) {
10684
10722
 
10685
10723
  /* */
10686
10724
 
10687
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10725
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10688
10726
  var fnInvokeRE = /\([^)]*?\);*$/;
10689
10727
  var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10690
10728
 
@@ -11453,6 +11491,8 @@ function checkNode (node, warn) {
11453
11491
  var range = node.rawAttrsMap[name];
11454
11492
  if (name === 'v-for') {
11455
11493
  checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11494
+ } else if (name === 'v-slot' || name[0] === '#') {
11495
+ checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
11456
11496
  } else if (onRE.test(name)) {
11457
11497
  checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11458
11498
  } else {
@@ -11472,9 +11512,9 @@ function checkNode (node, warn) {
11472
11512
  }
11473
11513
 
11474
11514
  function checkEvent (exp, text, warn, range) {
11475
- var stipped = exp.replace(stripStringRE, '');
11476
- var keywordMatch = stipped.match(unaryOperatorsRE);
11477
- if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11515
+ var stripped = exp.replace(stripStringRE, '');
11516
+ var keywordMatch = stripped.match(unaryOperatorsRE);
11517
+ if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11478
11518
  warn(
11479
11519
  "avoid using JavaScript unary operator as property name: " +
11480
11520
  "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
@@ -11529,6 +11569,19 @@ function checkExpression (exp, text, warn, range) {
11529
11569
  }
11530
11570
  }
11531
11571
 
11572
+ function checkFunctionParameterExpression (exp, text, warn, range) {
11573
+ try {
11574
+ new Function(exp, '');
11575
+ } catch (e) {
11576
+ warn(
11577
+ "invalid function parameter expression: " + (e.message) + " in\n\n" +
11578
+ " " + exp + "\n\n" +
11579
+ " Raw expression: " + (text.trim()) + "\n",
11580
+ range
11581
+ );
11582
+ }
11583
+ }
11584
+
11532
11585
  /* */
11533
11586
 
11534
11587
  var range = 2;