vue-model-x
Advanced tools
Comparing version 0.7.0 to 0.8.0
import { storeMeta } from './storeDecorator'; | ||
export var AppContainer = | ||
/*#__PURE__*/ | ||
function () { | ||
export var AppContainer = /*#__PURE__*/function () { | ||
function AppContainer(state) { | ||
@@ -35,6 +33,4 @@ this.stores = Object.create(null); | ||
var _arr = Object.keys(deps); | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var propName = _arr[_i]; | ||
for (var _i = 0, _Object$keys = Object.keys(deps); _i < _Object$keys.length; _i++) { | ||
var propName = _Object$keys[_i]; | ||
store[propName] = this.getStore(deps[propName]); | ||
@@ -41,0 +37,0 @@ } |
import { Watcher } from './vue-internals'; | ||
import { defineWatchersProperty, markAsStatic } from './utils'; | ||
export var Model = | ||
/*#__PURE__*/ | ||
function () { | ||
export var Model = /*#__PURE__*/function () { | ||
function Model() { | ||
@@ -7,0 +5,0 @@ // Tells Vue that it doesn't need to convert all properties of this object to reactive because |
@@ -20,6 +20,4 @@ import { AppContainer } from './AppContainer'; | ||
var _arr = Object.keys(stores); | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var propName = _arr[_i]; | ||
for (var _i = 0, _Object$keys = Object.keys(stores); _i < _Object$keys.length; _i++) { | ||
var propName = _Object$keys[_i]; | ||
this[propName] = appContainer.getStore(stores[propName]); | ||
@@ -26,0 +24,0 @@ } |
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
import { Model } from './Model'; | ||
export var Store = | ||
/*#__PURE__*/ | ||
function (_Model) { | ||
export var Store = /*#__PURE__*/function (_Model) { | ||
_inheritsLoose(Store, _Model); | ||
@@ -8,0 +6,0 @@ |
@@ -9,11 +9,13 @@ import { storeMeta } from './storeDecorator'; | ||
getStore(StoreConstructor) { | ||
const meta = StoreConstructor[storeMeta]; | ||
var meta = StoreConstructor[storeMeta]; | ||
if (!meta) { | ||
throw new Error(`VueModelX: couldn't find store meta information for "${StoreConstructor.name}" class.\n` + 'Did you forget to decorate it with `@store`?'); | ||
throw new Error("VueModelX: couldn't find store meta information for \"" + StoreConstructor.name + "\" class.\n" + 'Did you forget to decorate it with `@store`?'); | ||
} | ||
let name = meta.name, | ||
deps = meta.deps; | ||
let store = this.stores[name]; | ||
var { | ||
name, | ||
deps | ||
} = meta; | ||
var store = this.stores[name]; | ||
@@ -32,3 +34,3 @@ if (store) { | ||
for (const propName of Object.keys(deps)) { | ||
for (var propName of Object.keys(deps)) { | ||
store[propName] = this.getStore(deps[propName]); | ||
@@ -38,3 +40,3 @@ } | ||
const state = this.state.hasOwnProperty(name) ? this.state[name] : undefined; | ||
var state = this.state.hasOwnProperty(name) ? this.state[name] : undefined; | ||
@@ -44,3 +46,3 @@ if (store.init) { | ||
} else if (state) { | ||
throw new Error(`VueModelX: there is a serialized state for "${meta.name}" store but it doesn't implement "init" method`); | ||
throw new Error("VueModelX: there is a serialized state for \"" + meta.name + "\" store but it doesn't implement \"init\" method"); | ||
} | ||
@@ -47,0 +49,0 @@ |
import { Dep, Watcher } from './vue-internals'; | ||
import { defineWatchersProperty } from './utils'; | ||
const computedWatchers = Symbol('computedWatchers'); | ||
var computedWatchers = Symbol('computedWatchers'); | ||
/* istanbul ignore next */ | ||
const noop = () => {}; | ||
var noop = () => {}; | ||
export function computed(prototype, getterName, descriptor) { | ||
const getter = descriptor.get; | ||
var getter = descriptor.get; | ||
if (!getter) { | ||
throw new TypeError(`${prototype.constructor.name}#${getterName} is not a getter so it can't be used as computed property`); | ||
throw new TypeError(prototype.constructor.name + "#" + getterName + " is not a getter so it can't be used as computed property"); | ||
} | ||
@@ -34,4 +34,4 @@ | ||
const watchers = this[computedWatchers].get(prototype); | ||
let watcher = watchers[getterName]; | ||
var watchers = this[computedWatchers].get(prototype); | ||
var watcher = watchers[getterName]; | ||
@@ -38,0 +38,0 @@ if (!watcher) { |
@@ -25,7 +25,7 @@ import { Watcher } from './vue-internals'; | ||
if (typeof callback === 'string') { | ||
const methodName = callback; | ||
var methodName = callback; | ||
callback = this[methodName]; | ||
if (typeof callback !== 'function') { | ||
throw new TypeError(`VueModel#watch: model doesn't have "${methodName}" method`); | ||
throw new TypeError("VueModel#watch: model doesn't have \"" + methodName + "\" method"); | ||
} | ||
@@ -36,3 +36,3 @@ } | ||
options.user = false; | ||
const watcher = new Watcher(this, expression, callback, options); | ||
var watcher = new Watcher(this, expression, callback, options); | ||
@@ -39,0 +39,0 @@ if (options.immediate) { |
import { Dep, defineReactive } from './vue-internals'; | ||
const observableValues = Symbol('observableValues'); | ||
var observableValues = Symbol('observableValues'); | ||
export function observable(proto, name, descriptor) { | ||
@@ -8,3 +8,3 @@ Object.assign(descriptor, { | ||
}); | ||
const reactiveDescriptor = { | ||
var reactiveDescriptor = { | ||
configurable: true, | ||
@@ -14,3 +14,3 @@ enumerable: true, | ||
get() { | ||
let value; | ||
var value; | ||
@@ -17,0 +17,0 @@ if (this.hasOwnProperty(observableValues) && name in this[observableValues]) { |
import { AppContainer } from './AppContainer'; | ||
export function vueModelXPlugin(Vue, _temp) { | ||
let _ref = _temp === void 0 ? {} : _temp, | ||
appContainer = _ref.appContainer, | ||
state = _ref.state, | ||
_ref$injectProperty = _ref.injectProperty, | ||
injectProperty = _ref$injectProperty === void 0 ? '$app' : _ref$injectProperty; | ||
var { | ||
appContainer, | ||
state, | ||
injectProperty = '$app' | ||
} = _temp === void 0 ? {} : _temp; | ||
@@ -15,3 +15,5 @@ if (!appContainer) { | ||
beforeCreate() { | ||
const stores = this.$options.stores; | ||
var { | ||
stores | ||
} = this.$options; | ||
@@ -21,3 +23,3 @@ if (stores) { | ||
for (const propName of Object.keys(stores)) { | ||
for (var propName of Object.keys(stores)) { | ||
this[propName] = appContainer.getStore(stores[propName]); | ||
@@ -24,0 +26,0 @@ } |
import { Store } from './Store'; | ||
export const storeMeta = Symbol('VueModelXStoreMeta'); | ||
export var storeMeta = Symbol('VueModelXStoreMeta'); | ||
export function store(meta) { | ||
@@ -8,11 +8,11 @@ return function storeDecorator(cls) { | ||
/* eslint max-len: "off" */ | ||
`VueModelX: you must provide options for "@store" decorator with at least "name" property for "${cls.name}" class`); | ||
"VueModelX: you must provide options for \"@store\" decorator with at least \"name\" property for \"" + cls.name + "\" class"); | ||
} | ||
if (!meta.name) { | ||
throw new TypeError(`VueModelX: you must provide store name for "${cls.name}" class`); | ||
throw new TypeError("VueModelX: you must provide store name for \"" + cls.name + "\" class"); | ||
} | ||
if (!(cls.prototype instanceof Store)) { | ||
throw new TypeError(`VueModelX: "${cls.name}" class must extend "Store" class`); | ||
throw new TypeError("VueModelX: \"" + cls.name + "\" class must extend \"Store\" class"); | ||
} | ||
@@ -19,0 +19,0 @@ |
import Vue from 'vue'; | ||
const vue = new Vue({ | ||
var vue = new Vue({ | ||
watch: { | ||
@@ -8,6 +8,7 @@ w() {} | ||
}); | ||
export const Watcher = vue._watchers[0].constructor; | ||
export const Observer = vue.$data.__ob__.constructor; | ||
export const Dep = vue.$data.__ob__.dep.constructor; | ||
const defineReactive = Vue.util.defineReactive; | ||
export { defineReactive }; | ||
export var Watcher = vue._watchers[0].constructor; | ||
export var Observer = vue.$data.__ob__.constructor; | ||
export var Dep = vue.$data.__ob__.dep.constructor; | ||
export var { | ||
defineReactive | ||
} = Vue.util; |
{ | ||
"name": "vue-model-x", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "MobX-like state management library for Vue.js", | ||
@@ -9,3 +9,3 @@ "main": "./dist/node/index.js", | ||
"engines": { | ||
"node": ">= 8" | ||
"node": ">= 10" | ||
}, | ||
@@ -32,19 +32,19 @@ "scripts": { | ||
"peerDependencies": { | ||
"vue": ">= 2.5" | ||
"vue": ">=2.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.2.3", | ||
"@babel/core": "7.2.2", | ||
"@babel/plugin-proposal-class-properties": "7.3.0", | ||
"@babel/plugin-proposal-decorators": "7.3.0", | ||
"@babel/preset-env": "7.3.1", | ||
"@vue/test-utils": "1.0.0-beta.28", | ||
"@babel/cli": "7.10.1", | ||
"@babel/core": "7.10.2", | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/plugin-proposal-decorators": "7.10.1", | ||
"@babel/preset-env": "7.10.2", | ||
"@vue/test-utils": "1.0.3", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-eslint": "10.0.1", | ||
"babel-jest": "24.0.0", | ||
"eslint": "4.19.1", | ||
"eslint-config-th0r": "1.0.1", | ||
"jest": "24.0.0", | ||
"vue": ">= 2.5", | ||
"vue-template-compiler": ">= 2.5" | ||
"babel-eslint": "10.1.0", | ||
"babel-jest": "26.0.1", | ||
"eslint": "5.13.0", | ||
"eslint-config-th0r": "2.0.0", | ||
"jest": "26.0.1", | ||
"vue": ">=2.6", | ||
"vue-template-compiler": ">=2.6" | ||
}, | ||
@@ -51,0 +51,0 @@ "files": [ |
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
0
35467
41
1026