vue-class-component
Advanced tools
Comparing version 3.0.0 to 3.1.0
70
index.js
@@ -18,37 +18,47 @@ var Vue = require('vue') | ||
function decorator (options) { | ||
return function (Component) { | ||
options.name = options.name || Component.name | ||
// prototype props. | ||
var proto = Component.prototype | ||
Object.getOwnPropertyNames(proto).forEach(function (key) { | ||
if (key === 'constructor') { | ||
return | ||
function componentFactory (Component, options) { | ||
if (!options) { | ||
options = {} | ||
} | ||
options.name = options.name || Component.name | ||
// prototype props. | ||
var proto = Component.prototype | ||
Object.getOwnPropertyNames(proto).forEach(function (key) { | ||
if (key === 'constructor') { | ||
return | ||
} | ||
// hooks | ||
if (internalHooks.indexOf(key) > -1) { | ||
options[key] = proto[key] | ||
return | ||
} | ||
var descriptor = Object.getOwnPropertyDescriptor(proto, key) | ||
if (typeof descriptor.value === 'function') { | ||
// methods | ||
(options.methods || (options.methods = {}))[key] = descriptor.value | ||
} else if (descriptor.get || descriptor.set) { | ||
// computed properties | ||
(options.computed || (options.computed = {}))[key] = { | ||
get: descriptor.get, | ||
set: descriptor.set | ||
} | ||
// hooks | ||
if (internalHooks.indexOf(key) > -1) { | ||
options[key] = proto[key] | ||
return | ||
} | ||
var descriptor = Object.getOwnPropertyDescriptor(proto, key) | ||
if (typeof descriptor.value === 'function') { | ||
// methods | ||
(options.methods || (options.methods = {}))[key] = descriptor.value | ||
} else if (descriptor.get || descriptor.set) { | ||
// computed properties | ||
(options.computed || (options.computed = {}))[key] = { | ||
get: descriptor.get, | ||
set: descriptor.set | ||
} | ||
} | ||
}) | ||
// find super | ||
var Super = proto.__proto__.constructor | ||
if (!(Super instanceof Vue)) { | ||
Super = Vue | ||
} | ||
return Super.extend(options) | ||
}) | ||
// find super | ||
var Super = proto.__proto__.constructor | ||
if (!(Super instanceof Vue)) { | ||
Super = Vue | ||
} | ||
return Super.extend(options) | ||
} | ||
function decorator (options) { | ||
if (typeof options === 'function') { | ||
return componentFactory(options) | ||
} | ||
return function (Component) { | ||
return componentFactory(Component, options) | ||
} | ||
} | ||
module.exports = decorator |
{ | ||
"name": "vue-class-component", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "ES201X/TypeScript class decorator for Vue components", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"build": "webpack --config example/webpack.config.js", | ||
"dev": "webpack --config example/webpack.config.js --watch" | ||
"dev": "webpack --config example/webpack.config.js --watch", | ||
"test": "webpack --config test/webpack.config.js && mocha test/test.build.js" | ||
}, | ||
@@ -28,8 +29,10 @@ "repository": { | ||
"devDependencies": { | ||
"babel-core": "^5.6.7", | ||
"babel-loader": "^5.2.0", | ||
"node-libs-browser": "^0.5.2", | ||
"vue": "^1.0.4", | ||
"webpack": "^1.9.12" | ||
"babel-core": "^5.8.0", | ||
"babel-loader": "^5.3.3", | ||
"chai": "^3.5.0", | ||
"mocha": "^2.4.5", | ||
"node-libs-browser": "^1.0.0", | ||
"vue": "^1.0.16", | ||
"webpack": "^1.12.12" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
523429
10
17406
7
1