Skip to content

Commit df85865

Browse files
committed
[build] 2.0.0-rc.1
1 parent 8367d48 commit df85865

File tree

8 files changed

+114
-89
lines changed

8 files changed

+114
-89
lines changed

dist/vue.common.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,7 @@ function validateProp(key, propOptions, propsData, vm) {
25422542
var absent = !hasOwn(propsData, key);
25432543
var value = propsData[key];
25442544
// handle boolean props
2545-
if (prop.type === Boolean) {
2545+
if (getType(prop.type) === 'Boolean') {
25462546
if (absent && !hasOwn(prop, 'default')) {
25472547
value = false;
25482548
} else if (value === '' || value === hyphenate(key)) {
@@ -2623,27 +2623,20 @@ function assertProp(prop, name, value, vm, absent) {
26232623
*/
26242624
function assertType(value, type) {
26252625
var valid = void 0;
2626-
var expectedType = void 0;
2627-
if (type === String) {
2628-
expectedType = 'string';
2629-
valid = typeof value === expectedType;
2630-
} else if (type === Number) {
2631-
expectedType = 'number';
2632-
valid = typeof value === expectedType;
2633-
} else if (type === Boolean) {
2634-
expectedType = 'boolean';
2635-
valid = typeof value === expectedType;
2636-
} else if (type === Function) {
2637-
expectedType = 'function';
2638-
valid = typeof value === expectedType;
2639-
} else if (type === Object) {
2640-
expectedType = 'Object';
2626+
var expectedType = getType(type);
2627+
if (expectedType === 'String') {
2628+
valid = typeof value === (expectedType = 'string');
2629+
} else if (expectedType === 'Number') {
2630+
valid = typeof value === (expectedType = 'number');
2631+
} else if (expectedType === 'Boolean') {
2632+
valid = typeof value === (expectedType = 'boolean');
2633+
} else if (expectedType === 'Function') {
2634+
valid = typeof value === (expectedType = 'function');
2635+
} else if (expectedType === 'Object') {
26412636
valid = isPlainObject(value);
2642-
} else if (type === Array) {
2643-
expectedType = 'Array';
2637+
} else if (expectedType === 'Array') {
26442638
valid = Array.isArray(value);
26452639
} else {
2646-
expectedType = type.name || type.toString();
26472640
valid = value instanceof type;
26482641
}
26492642
return {
@@ -2652,6 +2645,16 @@ function assertType(value, type) {
26522645
};
26532646
}
26542647

2648+
/**
2649+
* Use function string name to check built-in types,
2650+
* because a simple equality check will fail when running
2651+
* across different vms / iframes.
2652+
*/
2653+
function getType(fn) {
2654+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
2655+
return match && match[1];
2656+
}
2657+
26552658

26562659

26572660
var util = Object.freeze({
@@ -2879,7 +2882,7 @@ Object.defineProperty(Vue.prototype, '$isServer', {
28792882
}
28802883
});
28812884

2882-
Vue.version = '2.0.0-beta.8';
2885+
Vue.version = '2.0.0-rc.1';
28832886

28842887
// attributes that should be using props for binding
28852888
var mustUseProp = makeMap('value,selected,checked,muted');

dist/vue.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* Vue.js v2.0.0-beta.8
2+
* Vue.js v2.0.0-rc.1
33
* (c) 2014-2016 Evan You
44
* Released under the MIT License.
55
*/
@@ -2547,7 +2547,7 @@
25472547
var absent = !hasOwn(propsData, key);
25482548
var value = propsData[key];
25492549
// handle boolean props
2550-
if (prop.type === Boolean) {
2550+
if (getType(prop.type) === 'Boolean') {
25512551
if (absent && !hasOwn(prop, 'default')) {
25522552
value = false;
25532553
} else if (value === '' || value === hyphenate(key)) {
@@ -2628,27 +2628,20 @@
26282628
*/
26292629
function assertType(value, type) {
26302630
var valid = void 0;
2631-
var expectedType = void 0;
2632-
if (type === String) {
2633-
expectedType = 'string';
2634-
valid = typeof value === expectedType;
2635-
} else if (type === Number) {
2636-
expectedType = 'number';
2637-
valid = typeof value === expectedType;
2638-
} else if (type === Boolean) {
2639-
expectedType = 'boolean';
2640-
valid = typeof value === expectedType;
2641-
} else if (type === Function) {
2642-
expectedType = 'function';
2643-
valid = typeof value === expectedType;
2644-
} else if (type === Object) {
2645-
expectedType = 'Object';
2631+
var expectedType = getType(type);
2632+
if (expectedType === 'String') {
2633+
valid = typeof value === (expectedType = 'string');
2634+
} else if (expectedType === 'Number') {
2635+
valid = typeof value === (expectedType = 'number');
2636+
} else if (expectedType === 'Boolean') {
2637+
valid = typeof value === (expectedType = 'boolean');
2638+
} else if (expectedType === 'Function') {
2639+
valid = typeof value === (expectedType = 'function');
2640+
} else if (expectedType === 'Object') {
26462641
valid = isPlainObject(value);
2647-
} else if (type === Array) {
2648-
expectedType = 'Array';
2642+
} else if (expectedType === 'Array') {
26492643
valid = Array.isArray(value);
26502644
} else {
2651-
expectedType = type.name || type.toString();
26522645
valid = value instanceof type;
26532646
}
26542647
return {
@@ -2657,6 +2650,16 @@
26572650
};
26582651
}
26592652

2653+
/**
2654+
* Use function string name to check built-in types,
2655+
* because a simple equality check will fail when running
2656+
* across different vms / iframes.
2657+
*/
2658+
function getType(fn) {
2659+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
2660+
return match && match[1];
2661+
}
2662+
26602663

26612664

26622665
var util = Object.freeze({
@@ -2884,7 +2887,7 @@
28842887
}
28852888
});
28862889

2887-
Vue.version = '2.0.0-beta.8';
2890+
Vue.version = '2.0.0-rc.1';
28882891

28892892
// attributes that should be using props for binding
28902893
var mustUseProp = makeMap('value,selected,checked,muted');

dist/vue.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/vue-server-renderer/build.js

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,7 +2653,7 @@ function validateProp(key, propOptions, propsData, vm) {
26532653
var absent = !hasOwn(propsData, key);
26542654
var value = propsData[key];
26552655
// handle boolean props
2656-
if (prop.type === Boolean) {
2656+
if (getType(prop.type) === 'Boolean') {
26572657
if (absent && !hasOwn(prop, 'default')) {
26582658
value = false;
26592659
} else if (value === '' || value === hyphenate(key)) {
@@ -2734,27 +2734,20 @@ function assertProp(prop, name, value, vm, absent) {
27342734
*/
27352735
function assertType(value, type) {
27362736
var valid = void 0;
2737-
var expectedType = void 0;
2738-
if (type === String) {
2739-
expectedType = 'string';
2740-
valid = typeof value === expectedType;
2741-
} else if (type === Number) {
2742-
expectedType = 'number';
2743-
valid = typeof value === expectedType;
2744-
} else if (type === Boolean) {
2745-
expectedType = 'boolean';
2746-
valid = typeof value === expectedType;
2747-
} else if (type === Function) {
2748-
expectedType = 'function';
2749-
valid = typeof value === expectedType;
2750-
} else if (type === Object) {
2751-
expectedType = 'Object';
2737+
var expectedType = getType(type);
2738+
if (expectedType === 'String') {
2739+
valid = typeof value === (expectedType = 'string');
2740+
} else if (expectedType === 'Number') {
2741+
valid = typeof value === (expectedType = 'number');
2742+
} else if (expectedType === 'Boolean') {
2743+
valid = typeof value === (expectedType = 'boolean');
2744+
} else if (expectedType === 'Function') {
2745+
valid = typeof value === (expectedType = 'function');
2746+
} else if (expectedType === 'Object') {
27522747
valid = isPlainObject(value);
2753-
} else if (type === Array) {
2754-
expectedType = 'Array';
2748+
} else if (expectedType === 'Array') {
27552749
valid = Array.isArray(value);
27562750
} else {
2757-
expectedType = type.name || type.toString();
27582751
valid = value instanceof type;
27592752
}
27602753
return {
@@ -2763,6 +2756,16 @@ function assertType(value, type) {
27632756
};
27642757
}
27652758

2759+
/**
2760+
* Use function string name to check built-in types,
2761+
* because a simple equality check will fail when running
2762+
* across different vms / iframes.
2763+
*/
2764+
function getType(fn) {
2765+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
2766+
return match && match[1];
2767+
}
2768+
27662769
// attributes that should be using props for binding
27672770
var mustUseProp = makeMap('value,selected,checked,muted');
27682771

@@ -4484,6 +4487,14 @@ function makeFunction(code) {
44844487
}
44854488
}
44864489

4490+
var warned = Object.create(null);
4491+
var warnOnce = function warnOnce(msg) {
4492+
if (!warned[msg]) {
4493+
warned[msg] = true;
4494+
console.warn('\n\u001b[31m' + msg + '\u001b[39m\n');
4495+
}
4496+
};
4497+
44874498
var normalizeAsync = function normalizeAsync(cache, method) {
44884499
var fn = cache[method];
44894500
if (!fn) {
@@ -4531,9 +4542,10 @@ function createRenderFunction(modules, directives, isUnaryTag, cache) {
45314542
// check cache hit
45324543
var Ctor = node.componentOptions.Ctor;
45334544
var getKey = Ctor.options.serverCacheKey;
4534-
if (getKey && cache) {
4545+
var name = Ctor.options.name;
4546+
if (getKey && cache && name) {
45354547
(function () {
4536-
var key = Ctor.cid + '::' + getKey(node.componentOptions.propsData);
4548+
var key = name + '::' + getKey(node.componentOptions.propsData);
45374549
if (has) {
45384550
has(key, function (hit) {
45394551
if (hit) {
@@ -4555,8 +4567,11 @@ function createRenderFunction(modules, directives, isUnaryTag, cache) {
45554567
}
45564568
})();
45574569
} else {
4558-
if (getKey) {
4559-
console.error('[vue-server-renderer] Component ' + (Ctor.options.name || '(anonymous)') + ' implemented serverCacheKey, ' + 'but no cache was provided to the renderer.');
4570+
if (getKey && !cache) {
4571+
warnOnce('[vue-server-renderer] Component ' + (Ctor.options.name || '(anonymous)') + ' implemented serverCacheKey, ' + 'but no cache was provided to the renderer.');
4572+
}
4573+
if (getKey && !name) {
4574+
warnOnce('[vue-server-renderer] Components that implement "serverCacheKey" ' + 'must also define a unique "name" option.');
45604575
}
45614576
renderComponent(node, write, next, isRoot);
45624577
}
@@ -4678,6 +4693,7 @@ function createRenderFunction(modules, directives, isUnaryTag, cache) {
46784693
}
46794694

46804695
return function render(component, write, done) {
4696+
warned = Object.create(null);
46814697
activeInstance = component;
46824698
normalizeRender(component);
46834699
renderNode(component._render(), write, done, true);

packages/vue-server-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-server-renderer",
3-
"version": "2.0.0-beta.8",
3+
"version": "2.0.0-rc.1",
44
"description": "server renderer for Vue 2.0",
55
"main": "index.js",
66
"repository": {

packages/vue-template-compiler/build.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,7 +2512,7 @@ function validateProp(key, propOptions, propsData, vm) {
25122512
var absent = !hasOwn(propsData, key);
25132513
var value = propsData[key];
25142514
// handle boolean props
2515-
if (prop.type === Boolean) {
2515+
if (getType(prop.type) === 'Boolean') {
25162516
if (absent && !hasOwn(prop, 'default')) {
25172517
value = false;
25182518
} else if (value === '' || value === hyphenate(key)) {
@@ -2593,27 +2593,20 @@ function assertProp(prop, name, value, vm, absent) {
25932593
*/
25942594
function assertType(value, type) {
25952595
var valid = void 0;
2596-
var expectedType = void 0;
2597-
if (type === String) {
2598-
expectedType = 'string';
2599-
valid = typeof value === expectedType;
2600-
} else if (type === Number) {
2601-
expectedType = 'number';
2602-
valid = typeof value === expectedType;
2603-
} else if (type === Boolean) {
2604-
expectedType = 'boolean';
2605-
valid = typeof value === expectedType;
2606-
} else if (type === Function) {
2607-
expectedType = 'function';
2608-
valid = typeof value === expectedType;
2609-
} else if (type === Object) {
2610-
expectedType = 'Object';
2596+
var expectedType = getType(type);
2597+
if (expectedType === 'String') {
2598+
valid = typeof value === (expectedType = 'string');
2599+
} else if (expectedType === 'Number') {
2600+
valid = typeof value === (expectedType = 'number');
2601+
} else if (expectedType === 'Boolean') {
2602+
valid = typeof value === (expectedType = 'boolean');
2603+
} else if (expectedType === 'Function') {
2604+
valid = typeof value === (expectedType = 'function');
2605+
} else if (expectedType === 'Object') {
26112606
valid = isPlainObject(value);
2612-
} else if (type === Array) {
2613-
expectedType = 'Array';
2607+
} else if (expectedType === 'Array') {
26142608
valid = Array.isArray(value);
26152609
} else {
2616-
expectedType = type.name || type.toString();
26172610
valid = value instanceof type;
26182611
}
26192612
return {
@@ -2622,6 +2615,16 @@ function assertType(value, type) {
26222615
};
26232616
}
26242617

2618+
/**
2619+
* Use function string name to check built-in types,
2620+
* because a simple equality check will fail when running
2621+
* across different vms / iframes.
2622+
*/
2623+
function getType(fn) {
2624+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
2625+
return match && match[1];
2626+
}
2627+
26252628
// attributes that should be using props for binding
26262629
var mustUseProp = makeMap('value,selected,checked,muted');
26272630

packages/vue-template-compiler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-template-compiler",
3-
"version": "2.0.0-beta.8",
3+
"version": "2.0.0-rc.1",
44
"description": "template compiler for Vue 2.0",
55
"main": "index.js",
66
"repository": {

src/core/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Object.defineProperty(Vue.prototype, '$isServer', {
88
get: () => config._isServer
99
})
1010

11-
Vue.version = '2.0.0-beta.8'
11+
Vue.version = '2.0.0-rc.1'
1212

1313
export default Vue

0 commit comments

Comments
 (0)