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.esm.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
  /* */
@@ -1861,10 +1861,11 @@ function invokeWithErrorHandling (
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 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
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 @@ if (process.env.NODE_ENV !== 'production') {
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
  );
@@ -2549,7 +2550,8 @@ function normalizeScopedSlots (
2549
2550
  prevSlots
2550
2551
  ) {
2551
2552
  var res;
2552
- var isStable = slots ? !!slots.$stable : true;
2553
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2554
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2553
2555
  var key = slots && slots.$key;
2554
2556
  if (!slots) {
2555
2557
  res = {};
@@ -2561,7 +2563,8 @@ function normalizeScopedSlots (
2561
2563
  prevSlots &&
2562
2564
  prevSlots !== emptyObject &&
2563
2565
  key === prevSlots.$key &&
2564
- Object.keys(normalSlots).length === 0
2566
+ !hasNormalSlots &&
2567
+ !prevSlots.$hasNormal
2565
2568
  ) {
2566
2569
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2567
2570
  // only need to normalize once
@@ -2587,6 +2590,7 @@ function normalizeScopedSlots (
2587
2590
  }
2588
2591
  def(res, '$stable', isStable);
2589
2592
  def(res, '$key', key);
2593
+ def(res, '$hasNormal', hasNormalSlots);
2590
2594
  return res
2591
2595
  }
2592
2596
 
@@ -2596,8 +2600,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2596
2600
  res = res && typeof res === 'object' && !Array.isArray(res)
2597
2601
  ? [res] // single vnode
2598
2602
  : normalizeChildren(res);
2599
- return res && res.length === 0
2600
- ? undefined
2603
+ return res && (
2604
+ res.length === 0 ||
2605
+ (res.length === 1 && res[0].isComment) // #9658
2606
+ ) ? undefined
2601
2607
  : res
2602
2608
  };
2603
2609
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2777,12 +2783,13 @@ function bindObjectProps (
2777
2783
  : data.attrs || (data.attrs = {});
2778
2784
  }
2779
2785
  var camelizedKey = camelize(key);
2780
- if (!(key in hash) && !(camelizedKey in hash)) {
2786
+ var hyphenatedKey = hyphenate(key);
2787
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2781
2788
  hash[key] = value[key];
2782
2789
 
2783
2790
  if (isSync) {
2784
2791
  var on = data.on || (data.on = {});
2785
- on[("update:" + camelizedKey)] = function ($event) {
2792
+ on[("update:" + key)] = function ($event) {
2786
2793
  value[key] = $event;
2787
2794
  };
2788
2795
  }
@@ -2913,7 +2920,7 @@ function bindDynamicKeys (baseObj, values) {
2913
2920
  if (typeof key === 'string' && key) {
2914
2921
  baseObj[values[i]] = values[i + 1];
2915
2922
  } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
2916
- // null is a speical value for explicitly removing a binding
2923
+ // null is a special value for explicitly removing a binding
2917
2924
  warn(
2918
2925
  ("Invalid value for dynamic directive argument (expected string or null): " + key),
2919
2926
  this
@@ -3409,6 +3416,12 @@ function _createElement (
3409
3416
  ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3410
3417
  if (config.isReservedTag(tag)) {
3411
3418
  // platform built-in elements
3419
+ if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn)) {
3420
+ warn(
3421
+ ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3422
+ context
3423
+ );
3424
+ }
3412
3425
  vnode = new VNode(
3413
3426
  config.parsePlatformTagName(tag), data, children,
3414
3427
  undefined, undefined, context
@@ -3537,7 +3550,7 @@ function renderMixin (Vue) {
3537
3550
  // render self
3538
3551
  var vnode;
3539
3552
  try {
3540
- // There's no need to maintain a stack becaues all render fns are called
3553
+ // There's no need to maintain a stack because all render fns are called
3541
3554
  // separately from one another. Nested component's render fns are called
3542
3555
  // when parent component is patched.
3543
3556
  currentRenderingInstance = vm;
@@ -3621,7 +3634,7 @@ function resolveAsyncComponent (
3621
3634
  }
3622
3635
 
3623
3636
  var owner = currentRenderingInstance;
3624
- if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3637
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3625
3638
  // already pending
3626
3639
  factory.owners.push(owner);
3627
3640
  }
@@ -3630,9 +3643,11 @@ function resolveAsyncComponent (
3630
3643
  return factory.loadingComp
3631
3644
  }
3632
3645
 
3633
- if (!isDef(factory.owners)) {
3646
+ if (owner && !isDef(factory.owners)) {
3634
3647
  var owners = factory.owners = [owner];
3635
- var sync = true
3648
+ var sync = true;
3649
+ var timerLoading = null;
3650
+ var timerTimeout = null
3636
3651
 
3637
3652
  ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3638
3653
 
@@ -3643,6 +3658,14 @@ function resolveAsyncComponent (
3643
3658
 
3644
3659
  if (renderCompleted) {
3645
3660
  owners.length = 0;
3661
+ if (timerLoading !== null) {
3662
+ clearTimeout(timerLoading);
3663
+ timerLoading = null;
3664
+ }
3665
+ if (timerTimeout !== null) {
3666
+ clearTimeout(timerTimeout);
3667
+ timerTimeout = null;
3668
+ }
3646
3669
  }
3647
3670
  };
3648
3671
 
@@ -3689,7 +3712,8 @@ function resolveAsyncComponent (
3689
3712
  if (res.delay === 0) {
3690
3713
  factory.loading = true;
3691
3714
  } else {
3692
- setTimeout(function () {
3715
+ timerLoading = setTimeout(function () {
3716
+ timerLoading = null;
3693
3717
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3694
3718
  factory.loading = true;
3695
3719
  forceRender(false);
@@ -3699,7 +3723,8 @@ function resolveAsyncComponent (
3699
3723
  }
3700
3724
 
3701
3725
  if (isDef(res.timeout)) {
3702
- setTimeout(function () {
3726
+ timerTimeout = setTimeout(function () {
3727
+ timerTimeout = null;
3703
3728
  if (isUndef(factory.resolved)) {
3704
3729
  reject(
3705
3730
  process.env.NODE_ENV !== 'production'
@@ -4247,11 +4272,21 @@ var getNow = Date.now;
4247
4272
  // timestamp can either be hi-res (relative to page load) or low-res
4248
4273
  // (relative to UNIX epoch), so in order to compare time we have to use the
4249
4274
  // same timestamp type when saving the flush timestamp.
4250
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4251
- // if the low-res timestamp which is bigger than the event timestamp
4252
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4253
- // and we need to use the hi-res version for event listeners as well.
4254
- getNow = function () { return performance.now(); };
4275
+ // All IE versions use low-res event timestamps, and have problematic clock
4276
+ // implementations (#9632)
4277
+ if (inBrowser && !isIE) {
4278
+ var performance = window.performance;
4279
+ if (
4280
+ performance &&
4281
+ typeof performance.now === 'function' &&
4282
+ getNow() > document.createEvent('Event').timeStamp
4283
+ ) {
4284
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4285
+ // smaller than it, it means the event is using a hi-res timestamp,
4286
+ // and we need to use the hi-res version for event listener timestamps as
4287
+ // well.
4288
+ getNow = function () { return performance.now(); };
4289
+ }
4255
4290
  }
4256
4291
 
4257
4292
  /**
@@ -5424,7 +5459,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5424
5459
  value: FunctionalRenderContext
5425
5460
  });
5426
5461
 
5427
- Vue.version = '2.6.8';
5462
+ Vue.version = '2.6.12';
5428
5463
 
5429
5464
  /* */
5430
5465
 
@@ -6097,7 +6132,7 @@ function createPatchFunction (backend) {
6097
6132
  }
6098
6133
  }
6099
6134
 
6100
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6135
+ function removeVnodes (vnodes, startIdx, endIdx) {
6101
6136
  for (; startIdx <= endIdx; ++startIdx) {
6102
6137
  var ch = vnodes[startIdx];
6103
6138
  if (isDef(ch)) {
@@ -6208,7 +6243,7 @@ function createPatchFunction (backend) {
6208
6243
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6209
6244
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6210
6245
  } else if (newStartIdx > newEndIdx) {
6211
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6246
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6212
6247
  }
6213
6248
  }
6214
6249
 
@@ -6300,7 +6335,7 @@ function createPatchFunction (backend) {
6300
6335
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6301
6336
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6302
6337
  } else if (isDef(oldCh)) {
6303
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6338
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6304
6339
  } else if (isDef(oldVnode.text)) {
6305
6340
  nodeOps.setTextContent(elm, '');
6306
6341
  }
@@ -6531,7 +6566,7 @@ function createPatchFunction (backend) {
6531
6566
 
6532
6567
  // destroy old node
6533
6568
  if (isDef(parentElm)) {
6534
- removeVnodes(parentElm, [oldVnode], 0, 0);
6569
+ removeVnodes([oldVnode], 0, 0);
6535
6570
  } else if (isDef(oldVnode.tag)) {
6536
6571
  invokeDestroyHook(oldVnode);
6537
6572
  }
@@ -7518,8 +7553,10 @@ function add$1 (
7518
7553
  e.target === e.currentTarget ||
7519
7554
  // event is fired after handler attachment
7520
7555
  e.timeStamp >= attachedTimestamp ||
7521
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
7522
- e.timeStamp === 0 ||
7556
+ // bail for environments that have buggy event.timeStamp implementations
7557
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7558
+ // #9681 QtWebEngine event.timeStamp is negative value
7559
+ e.timeStamp <= 0 ||
7523
7560
  // #9448 bail if event is fired in another document in a multi-page
7524
7561
  // electron/nw.js app, since event.timeStamp will be using a different
7525
7562
  // starting reference
@@ -7586,10 +7623,11 @@ function updateDOMProps (oldVnode, vnode) {
7586
7623
  }
7587
7624
 
7588
7625
  for (key in oldProps) {
7589
- if (isUndef(props[key])) {
7626
+ if (!(key in props)) {
7590
7627
  elm[key] = '';
7591
7628
  }
7592
7629
  }
7630
+
7593
7631
  for (key in props) {
7594
7632
  cur = props[key];
7595
7633
  // ignore children if the node has textContent or innerHTML,
@@ -7629,7 +7667,7 @@ function updateDOMProps (oldVnode, vnode) {
7629
7667
  // skip the update if old and new VDOM state is the same.
7630
7668
  // `value` is handled separately because the DOM value may be temporarily
7631
7669
  // out of sync with VDOM state due to focus, composition and modifiers.
7632
- // This #4521 by skipping the unnecesarry `checked` update.
7670
+ // This #4521 by skipping the unnecessary `checked` update.
7633
7671
  cur !== oldProps[key]
7634
7672
  ) {
7635
7673
  // some property updates can throw
@@ -8137,8 +8175,8 @@ function enter (vnode, toggleDisplay) {
8137
8175
  var context = activeInstance;
8138
8176
  var transitionNode = activeInstance.$vnode;
8139
8177
  while (transitionNode && transitionNode.parent) {
8140
- transitionNode = transitionNode.parent;
8141
8178
  context = transitionNode.context;
8179
+ transitionNode = transitionNode.parent;
8142
8180
  }
8143
8181
 
8144
8182
  var isAppear = !context._isMounted || !vnode.isRootInsert;
@@ -9240,7 +9278,7 @@ var startTagOpen = new RegExp(("^<" + qnameCapture));
9240
9278
  var startTagClose = /^\s*(\/?)>/;
9241
9279
  var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9242
9280
  var doctype = /^<!DOCTYPE [^>]+>/i;
9243
- // #7298: escape - to avoid being pased as HTML comment when inlined in page
9281
+ // #7298: escape - to avoid being passed as HTML comment when inlined in page
9244
9282
  var comment = /^<!\--/;
9245
9283
  var conditionalComment = /^<!\[/;
9246
9284
 
@@ -9526,7 +9564,7 @@ function parseHTML (html, options) {
9526
9564
  /* */
9527
9565
 
9528
9566
  var onRE = /^@|^v-on:/;
9529
- var dirRE = /^v-|^@|^:/;
9567
+ var dirRE = /^v-|^@|^:|^#/;
9530
9568
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9531
9569
  var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9532
9570
  var stripParensRE = /^\(|\)$/g;
@@ -9852,7 +9890,7 @@ function parse (
9852
9890
  text = preserveWhitespace ? ' ' : '';
9853
9891
  }
9854
9892
  if (text) {
9855
- if (whitespaceOption === 'condense') {
9893
+ if (!inPre && whitespaceOption === 'condense') {
9856
9894
  // condense consecutive whitespaces into single space
9857
9895
  text = text.replace(whitespaceRE$1, ' ');
9858
9896
  }
@@ -9881,7 +9919,7 @@ function parse (
9881
9919
  }
9882
9920
  },
9883
9921
  comment: function comment (text, start, end) {
9884
- // adding anyting as a sibling to the root node is forbidden
9922
+ // adding anything as a sibling to the root node is forbidden
9885
9923
  // comments should still be allowed, but ignored
9886
9924
  if (currentParent) {
9887
9925
  var child = {
@@ -10150,7 +10188,7 @@ function processSlotContent (el) {
10150
10188
  if (el.parent && !maybeComponent(el.parent)) {
10151
10189
  warn$2(
10152
10190
  "<template v-slot> can only appear at the root level inside " +
10153
- "the receiving the component",
10191
+ "the receiving component",
10154
10192
  el
10155
10193
  );
10156
10194
  }
@@ -10715,7 +10753,7 @@ function isDirectChildOfTemplateFor (node) {
10715
10753
 
10716
10754
  /* */
10717
10755
 
10718
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10756
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10719
10757
  var fnInvokeRE = /\([^)]*?\);*$/;
10720
10758
  var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10721
10759
 
@@ -11487,6 +11525,8 @@ function checkNode (node, warn) {
11487
11525
  var range = node.rawAttrsMap[name];
11488
11526
  if (name === 'v-for') {
11489
11527
  checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11528
+ } else if (name === 'v-slot' || name[0] === '#') {
11529
+ checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
11490
11530
  } else if (onRE.test(name)) {
11491
11531
  checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11492
11532
  } else {
@@ -11506,9 +11546,9 @@ function checkNode (node, warn) {
11506
11546
  }
11507
11547
 
11508
11548
  function checkEvent (exp, text, warn, range) {
11509
- var stipped = exp.replace(stripStringRE, '');
11510
- var keywordMatch = stipped.match(unaryOperatorsRE);
11511
- if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11549
+ var stripped = exp.replace(stripStringRE, '');
11550
+ var keywordMatch = stripped.match(unaryOperatorsRE);
11551
+ if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11512
11552
  warn(
11513
11553
  "avoid using JavaScript unary operator as property name: " +
11514
11554
  "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
@@ -11563,6 +11603,19 @@ function checkExpression (exp, text, warn, range) {
11563
11603
  }
11564
11604
  }
11565
11605
 
11606
+ function checkFunctionParameterExpression (exp, text, warn, range) {
11607
+ try {
11608
+ new Function(exp, '');
11609
+ } catch (e) {
11610
+ warn(
11611
+ "invalid function parameter expression: " + (e.message) + " in\n\n" +
11612
+ " " + exp + "\n\n" +
11613
+ " Raw expression: " + (text.trim()) + "\n",
11614
+ range
11615
+ );
11616
+ }
11617
+ }
11618
+
11566
11619
  /* */
11567
11620
 
11568
11621
  var range = 2;