11/**
2- * vue-class-component v6.1.0
2+ * vue-class-component v6.1.1
33 * (c) 2015-2017 Evan You
44 * @license MIT
55 */
@@ -11,6 +11,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
1111
1212var Vue = _interopDefault ( require ( 'vue' ) ) ;
1313
14+ var hasProto = { __proto__ : [ ] } instanceof Array ;
1415function createDecorator ( factory ) {
1516 return function ( target , key , index ) {
1617 var Ctor = typeof target === 'function'
@@ -25,6 +26,10 @@ function createDecorator(factory) {
2526 Ctor . __decorators__ . push ( function ( options ) { return factory ( options , key , index ) ; } ) ;
2627 } ;
2728}
29+ function isPrimitive ( value ) {
30+ var type = typeof value ;
31+ return value == null || ( type !== "object" && type !== "function" ) ;
32+ }
2833function warn ( message ) {
2934 if ( typeof console !== 'undefined' ) {
3035 console . warn ( '[vue-class-component] ' + message ) ;
@@ -114,19 +119,57 @@ function componentFactory(Component, options) {
114119 var decorators = Component . __decorators__ ;
115120 if ( decorators ) {
116121 decorators . forEach ( function ( fn ) { return fn ( options ) ; } ) ;
122+ delete Component . __decorators__ ;
117123 }
118124 var superProto = Object . getPrototypeOf ( Component . prototype ) ;
119125 var Super = superProto instanceof Vue
120126 ? superProto . constructor
121127 : Vue ;
122128 var Extended = Super . extend ( options ) ;
123- for ( var staticKey in Component ) {
124- if ( Component . hasOwnProperty ( staticKey ) ) {
125- Extended [ staticKey ] = Component [ staticKey ] ;
126- }
127- }
129+ forwardStaticMembers ( Extended , Component , Super ) ;
128130 return Extended ;
129131}
132+ var reservedPropertyNames = [
133+ 'cid' ,
134+ 'super' ,
135+ 'options' ,
136+ 'superOptions' ,
137+ 'extendOptions' ,
138+ 'sealedOptions' ,
139+ 'component' ,
140+ 'directive' ,
141+ 'filter'
142+ ] ;
143+ function forwardStaticMembers ( Extended , Original , Super ) {
144+ Object . getOwnPropertyNames ( Original ) . forEach ( function ( key ) {
145+ if ( key === 'prototype' ) {
146+ return ;
147+ }
148+ var extendedDescriptor = Object . getOwnPropertyDescriptor ( Extended , key ) ;
149+ if ( extendedDescriptor && ! extendedDescriptor . configurable ) {
150+ return ;
151+ }
152+ var descriptor = Object . getOwnPropertyDescriptor ( Original , key ) ;
153+ if ( ! hasProto ) {
154+ if ( key === 'cid' ) {
155+ return ;
156+ }
157+ var superDescriptor = Object . getOwnPropertyDescriptor ( Super , key ) ;
158+ if ( ! isPrimitive ( descriptor . value )
159+ && superDescriptor
160+ && superDescriptor . value === descriptor . value ) {
161+ return ;
162+ }
163+ }
164+ if ( process . env . NODE_ENV !== 'production'
165+ && reservedPropertyNames . indexOf ( key ) >= 0 ) {
166+ warn ( "Static property name '" + key + "' declared on class '" + Original . name + "' " +
167+ 'conflicts with reserved property name of Vue internal. ' +
168+ 'It may cause unexpected behavior of the component. Consider renaming the property.' ) ;
169+ }
170+ Object . defineProperty ( Extended , key , descriptor ) ;
171+ } ) ;
172+ }
130173
131174function Component ( options ) {
132175 if ( typeof options === 'function' ) {
0 commit comments