Skip to content

Commit

Permalink
build: bundle 3.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 15, 2020
1 parent 0fb1343 commit 9828c1e
Show file tree
Hide file tree
Showing 6 changed files with 212 additions and 112 deletions.
79 changes: 52 additions & 27 deletions dist/vue-router.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-router v3.1.4
* vue-router v3.1.5
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -68,32 +68,45 @@ var View = {
var depth = 0;
var inactive = false;
while (parent && parent._routerRoot !== parent) {
var vnodeData = parent.$vnode && parent.$vnode.data;
if (vnodeData) {
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._inactive) {
inactive = true;
}
var vnodeData = parent.$vnode ? parent.$vnode.data : {};
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
inactive = true;
}
parent = parent.$parent;
}
data.routerViewDepth = depth;

// render previous view if the tree is inactive and kept-alive
if (inactive) {
return h(cache[name], data, children)
var cachedData = cache[name];
var cachedComponent = cachedData && cachedData.component;
if (cachedComponent) {
// #2301
// pass props
if (cachedData.configProps) {
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
}
return h(cachedComponent, data, children)
} else {
// render previous empty view
return h()
}
}

var matched = route.matched[depth];
// render empty node if no matched route
if (!matched) {
var component = matched && matched.components[name];

// render empty node if no matched route or no config component
if (!matched || !component) {
cache[name] = null;
return h()
}

var component = cache[name] = matched.components[name];
// cache component
cache[name] = { component: component };

// attach instance registration hook
// this will be called in the instance's injected lifecycle hooks
Expand Down Expand Up @@ -125,25 +138,37 @@ var View = {
}
};

// resolve props
var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
var attrs = data.attrs = data.attrs || {};
for (var key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
var configProps = matched.props && matched.props[name];
// save route and configProps in cachce
if (configProps) {
extend(cache[name], {
route: route,
configProps: configProps
});
fillPropsinData(component, data, route, configProps);
}

return h(component, data, children)
}
};

function fillPropsinData (component, data, route, configProps) {
// resolve props
var propsToPass = data.props = resolveProps(route, configProps);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
var attrs = data.attrs = data.attrs || {};
for (var key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
}
}

function resolveProps (route, config) {
switch (typeof config) {
case 'undefined':
Expand Down Expand Up @@ -2882,7 +2907,7 @@ function createHref (base, fullPath, mode) {
}

VueRouter.install = install;
VueRouter.version = '3.1.4';
VueRouter.version = '3.1.5';

if (inBrowser && window.Vue) {
window.Vue.use(VueRouter);
Expand Down
79 changes: 52 additions & 27 deletions dist/vue-router.esm.browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-router v3.1.4
* vue-router v3.1.5
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -61,32 +61,45 @@ var View = {
let depth = 0;
let inactive = false;
while (parent && parent._routerRoot !== parent) {
const vnodeData = parent.$vnode && parent.$vnode.data;
if (vnodeData) {
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._inactive) {
inactive = true;
}
const vnodeData = parent.$vnode ? parent.$vnode.data : {};
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
inactive = true;
}
parent = parent.$parent;
}
data.routerViewDepth = depth;

// render previous view if the tree is inactive and kept-alive
if (inactive) {
return h(cache[name], data, children)
const cachedData = cache[name];
const cachedComponent = cachedData && cachedData.component;
if (cachedComponent) {
// #2301
// pass props
if (cachedData.configProps) {
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
}
return h(cachedComponent, data, children)
} else {
// render previous empty view
return h()
}
}

const matched = route.matched[depth];
// render empty node if no matched route
if (!matched) {
const component = matched && matched.components[name];

// render empty node if no matched route or no config component
if (!matched || !component) {
cache[name] = null;
return h()
}

const component = cache[name] = matched.components[name];
// cache component
cache[name] = { component };

// attach instance registration hook
// this will be called in the instance's injected lifecycle hooks
Expand Down Expand Up @@ -118,25 +131,37 @@ var View = {
}
};

// resolve props
let propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
const attrs = data.attrs = data.attrs || {};
for (const key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
const configProps = matched.props && matched.props[name];
// save route and configProps in cachce
if (configProps) {
extend(cache[name], {
route,
configProps
});
fillPropsinData(component, data, route, configProps);
}

return h(component, data, children)
}
};

function fillPropsinData (component, data, route, configProps) {
// resolve props
let propsToPass = data.props = resolveProps(route, configProps);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
const attrs = data.attrs = data.attrs || {};
for (const key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
}
}

function resolveProps (route, config) {
switch (typeof config) {
case 'undefined':
Expand Down Expand Up @@ -2832,7 +2857,7 @@ function createHref (base, fullPath, mode) {
}

VueRouter.install = install;
VueRouter.version = '3.1.4';
VueRouter.version = '3.1.5';

if (inBrowser && window.Vue) {
window.Vue.use(VueRouter);
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-router.esm.browser.min.js

Large diffs are not rendered by default.

79 changes: 52 additions & 27 deletions dist/vue-router.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-router v3.1.4
* vue-router v3.1.5
* (c) 2020 Evan You
* @license MIT
*/
Expand Down Expand Up @@ -66,32 +66,45 @@ var View = {
var depth = 0;
var inactive = false;
while (parent && parent._routerRoot !== parent) {
var vnodeData = parent.$vnode && parent.$vnode.data;
if (vnodeData) {
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._inactive) {
inactive = true;
}
var vnodeData = parent.$vnode ? parent.$vnode.data : {};
if (vnodeData.routerView) {
depth++;
}
if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
inactive = true;
}
parent = parent.$parent;
}
data.routerViewDepth = depth;

// render previous view if the tree is inactive and kept-alive
if (inactive) {
return h(cache[name], data, children)
var cachedData = cache[name];
var cachedComponent = cachedData && cachedData.component;
if (cachedComponent) {
// #2301
// pass props
if (cachedData.configProps) {
fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
}
return h(cachedComponent, data, children)
} else {
// render previous empty view
return h()
}
}

var matched = route.matched[depth];
// render empty node if no matched route
if (!matched) {
var component = matched && matched.components[name];

// render empty node if no matched route or no config component
if (!matched || !component) {
cache[name] = null;
return h()
}

var component = cache[name] = matched.components[name];
// cache component
cache[name] = { component: component };

// attach instance registration hook
// this will be called in the instance's injected lifecycle hooks
Expand Down Expand Up @@ -123,25 +136,37 @@ var View = {
}
};

// resolve props
var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
var attrs = data.attrs = data.attrs || {};
for (var key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
var configProps = matched.props && matched.props[name];
// save route and configProps in cachce
if (configProps) {
extend(cache[name], {
route: route,
configProps: configProps
});
fillPropsinData(component, data, route, configProps);
}

return h(component, data, children)
}
};

function fillPropsinData (component, data, route, configProps) {
// resolve props
var propsToPass = data.props = resolveProps(route, configProps);
if (propsToPass) {
// clone to prevent mutation
propsToPass = data.props = extend({}, propsToPass);
// pass non-declared props as attrs
var attrs = data.attrs = data.attrs || {};
for (var key in propsToPass) {
if (!component.props || !(key in component.props)) {
attrs[key] = propsToPass[key];
delete propsToPass[key];
}
}
}
}

function resolveProps (route, config) {
switch (typeof config) {
case 'undefined':
Expand Down Expand Up @@ -2880,7 +2905,7 @@ function createHref (base, fullPath, mode) {
}

VueRouter.install = install;
VueRouter.version = '3.1.4';
VueRouter.version = '3.1.5';

if (inBrowser && window.Vue) {
window.Vue.use(VueRouter);
Expand Down

0 comments on commit 9828c1e

Please sign in to comment.