瀏覽代碼

realese: v3.2.0

ktsn 5 年之前
父節點
當前提交
fa1ccde633
共有 8 個文件被更改,包括 104 次插入11 次删除
  1. 9 0
      CHANGELOG.md
  2. 23 2
      dist/vuex.common.js
  3. 23 2
      dist/vuex.esm.browser.js
  4. 1 1
      dist/vuex.esm.browser.min.js
  5. 23 2
      dist/vuex.esm.js
  6. 23 2
      dist/vuex.js
  7. 1 1
      dist/vuex.min.js
  8. 1 1
      package.json

+ 9 - 0
CHANGELOG.md

@@ -1,3 +1,12 @@
+# [3.2.0](https://github.com/vuejs/vuex/compare/v3.1.3...v3.2.0) (2020-04-19)
+
+
+### Features
+
+* add Store#hasModule(path) API ([#834](https://github.com/vuejs/vuex/issues/834)) ([d65d142](https://github.com/vuejs/vuex/commit/d65d14276e87aca17cfbd3fbf4af9e8dbb808f24))
+
+
+
 ## [3.1.3](https://github.com/vuejs/vuex/compare/v3.1.2...v3.1.3) (2020-03-09)
 ## [3.1.3](https://github.com/vuejs/vuex/compare/v3.1.2...v3.1.3) (2020-03-09)
 
 
 
 

+ 23 - 2
dist/vuex.common.js

@@ -1,5 +1,5 @@
 /**
 /**
- * vuex v3.1.3
+ * vuex v3.2.0
  * (c) 2020 Evan You
  * (c) 2020 Evan You
  * @license MIT
  * @license MIT
  */
  */
@@ -129,6 +129,10 @@ Module.prototype.getChild = function getChild (key) {
   return this._children[key]
   return this._children[key]
 };
 };
 
 
+Module.prototype.hasChild = function hasChild (key) {
+  return key in this._children
+};
+
 Module.prototype.update = function update (rawModule) {
 Module.prototype.update = function update (rawModule) {
   this._rawModule.namespaced = rawModule.namespaced;
   this._rawModule.namespaced = rawModule.namespaced;
   if (rawModule.actions) {
   if (rawModule.actions) {
@@ -221,6 +225,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
   parent.removeChild(key);
   parent.removeChild(key);
 };
 };
 
 
+ModuleCollection.prototype.isRegistered = function isRegistered (path) {
+  var parent = this.get(path.slice(0, -1));
+  var key = path[path.length - 1];
+
+  return parent.hasChild(key)
+};
+
 function update (path, targetModule, newModule) {
 function update (path, targetModule, newModule) {
   if (process.env.NODE_ENV !== 'production') {
   if (process.env.NODE_ENV !== 'production') {
     assertRawModule(path, newModule);
     assertRawModule(path, newModule);
@@ -517,6 +528,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
   resetStore(this);
   resetStore(this);
 };
 };
 
 
+Store.prototype.hasModule = function hasModule (path) {
+  if (typeof path === 'string') { path = [path]; }
+
+  if (process.env.NODE_ENV !== 'production') {
+    assert(Array.isArray(path), "module path must be a string or an Array.");
+  }
+
+  return this._modules.isRegistered(path)
+};
+
 Store.prototype.hotUpdate = function hotUpdate (newOptions) {
 Store.prototype.hotUpdate = function hotUpdate (newOptions) {
   this._modules.update(newOptions);
   this._modules.update(newOptions);
   resetStore(this, true);
   resetStore(this, true);
@@ -1041,7 +1062,7 @@ function getModuleByNamespace (store, helper, namespace) {
 var index = {
 var index = {
   Store: Store,
   Store: Store,
   install: install,
   install: install,
-  version: '3.1.3',
+  version: '3.2.0',
   mapState: mapState,
   mapState: mapState,
   mapMutations: mapMutations,
   mapMutations: mapMutations,
   mapGetters: mapGetters,
   mapGetters: mapGetters,

+ 23 - 2
dist/vuex.esm.browser.js

@@ -1,5 +1,5 @@
 /**
 /**
- * vuex v3.1.3
+ * vuex v3.2.0
  * (c) 2020 Evan You
  * (c) 2020 Evan You
  * @license MIT
  * @license MIT
  */
  */
@@ -124,6 +124,10 @@ class Module {
     return this._children[key]
     return this._children[key]
   }
   }
 
 
+  hasChild (key) {
+    return key in this._children
+  }
+
   update (rawModule) {
   update (rawModule) {
     this._rawModule.namespaced = rawModule.namespaced;
     this._rawModule.namespaced = rawModule.namespaced;
     if (rawModule.actions) {
     if (rawModule.actions) {
@@ -212,6 +216,13 @@ class ModuleCollection {
 
 
     parent.removeChild(key);
     parent.removeChild(key);
   }
   }
+
+  isRegistered (path) {
+    const parent = this.get(path.slice(0, -1));
+    const key = path[path.length - 1];
+
+    return parent.hasChild(key)
+  }
 }
 }
 
 
 function update (path, targetModule, newModule) {
 function update (path, targetModule, newModule) {
@@ -495,6 +506,16 @@ class Store {
     resetStore(this);
     resetStore(this);
   }
   }
 
 
+  hasModule (path) {
+    if (typeof path === 'string') path = [path];
+
+    {
+      assert(Array.isArray(path), `module path must be a string or an Array.`);
+    }
+
+    return this._modules.isRegistered(path)
+  }
+
   hotUpdate (newOptions) {
   hotUpdate (newOptions) {
     this._modules.update(newOptions);
     this._modules.update(newOptions);
     resetStore(this, true);
     resetStore(this, true);
@@ -998,7 +1019,7 @@ function getModuleByNamespace (store, helper, namespace) {
 var index_esm = {
 var index_esm = {
   Store,
   Store,
   install,
   install,
-  version: '3.1.3',
+  version: '3.2.0',
   mapState,
   mapState,
   mapMutations,
   mapMutations,
   mapGetters,
   mapGetters,

File diff suppressed because it is too large
+ 1 - 1
dist/vuex.esm.browser.min.js


+ 23 - 2
dist/vuex.esm.js

@@ -1,5 +1,5 @@
 /**
 /**
- * vuex v3.1.3
+ * vuex v3.2.0
  * (c) 2020 Evan You
  * (c) 2020 Evan You
  * @license MIT
  * @license MIT
  */
  */
@@ -127,6 +127,10 @@ Module.prototype.getChild = function getChild (key) {
   return this._children[key]
   return this._children[key]
 };
 };
 
 
+Module.prototype.hasChild = function hasChild (key) {
+  return key in this._children
+};
+
 Module.prototype.update = function update (rawModule) {
 Module.prototype.update = function update (rawModule) {
   this._rawModule.namespaced = rawModule.namespaced;
   this._rawModule.namespaced = rawModule.namespaced;
   if (rawModule.actions) {
   if (rawModule.actions) {
@@ -219,6 +223,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
   parent.removeChild(key);
   parent.removeChild(key);
 };
 };
 
 
+ModuleCollection.prototype.isRegistered = function isRegistered (path) {
+  var parent = this.get(path.slice(0, -1));
+  var key = path[path.length - 1];
+
+  return parent.hasChild(key)
+};
+
 function update (path, targetModule, newModule) {
 function update (path, targetModule, newModule) {
   if (process.env.NODE_ENV !== 'production') {
   if (process.env.NODE_ENV !== 'production') {
     assertRawModule(path, newModule);
     assertRawModule(path, newModule);
@@ -515,6 +526,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
   resetStore(this);
   resetStore(this);
 };
 };
 
 
+Store.prototype.hasModule = function hasModule (path) {
+  if (typeof path === 'string') { path = [path]; }
+
+  if (process.env.NODE_ENV !== 'production') {
+    assert(Array.isArray(path), "module path must be a string or an Array.");
+  }
+
+  return this._modules.isRegistered(path)
+};
+
 Store.prototype.hotUpdate = function hotUpdate (newOptions) {
 Store.prototype.hotUpdate = function hotUpdate (newOptions) {
   this._modules.update(newOptions);
   this._modules.update(newOptions);
   resetStore(this, true);
   resetStore(this, true);
@@ -1039,7 +1060,7 @@ function getModuleByNamespace (store, helper, namespace) {
 var index_esm = {
 var index_esm = {
   Store: Store,
   Store: Store,
   install: install,
   install: install,
-  version: '3.1.3',
+  version: '3.2.0',
   mapState: mapState,
   mapState: mapState,
   mapMutations: mapMutations,
   mapMutations: mapMutations,
   mapGetters: mapGetters,
   mapGetters: mapGetters,

+ 23 - 2
dist/vuex.js

@@ -1,5 +1,5 @@
 /**
 /**
- * vuex v3.1.3
+ * vuex v3.2.0
  * (c) 2020 Evan You
  * (c) 2020 Evan You
  * @license MIT
  * @license MIT
  */
  */
@@ -133,6 +133,10 @@
     return this._children[key]
     return this._children[key]
   };
   };
 
 
+  Module.prototype.hasChild = function hasChild (key) {
+    return key in this._children
+  };
+
   Module.prototype.update = function update (rawModule) {
   Module.prototype.update = function update (rawModule) {
     this._rawModule.namespaced = rawModule.namespaced;
     this._rawModule.namespaced = rawModule.namespaced;
     if (rawModule.actions) {
     if (rawModule.actions) {
@@ -225,6 +229,13 @@
     parent.removeChild(key);
     parent.removeChild(key);
   };
   };
 
 
+  ModuleCollection.prototype.isRegistered = function isRegistered (path) {
+    var parent = this.get(path.slice(0, -1));
+    var key = path[path.length - 1];
+
+    return parent.hasChild(key)
+  };
+
   function update (path, targetModule, newModule) {
   function update (path, targetModule, newModule) {
     {
     {
       assertRawModule(path, newModule);
       assertRawModule(path, newModule);
@@ -520,6 +531,16 @@
     resetStore(this);
     resetStore(this);
   };
   };
 
 
+  Store.prototype.hasModule = function hasModule (path) {
+    if (typeof path === 'string') { path = [path]; }
+
+    {
+      assert(Array.isArray(path), "module path must be a string or an Array.");
+    }
+
+    return this._modules.isRegistered(path)
+  };
+
   Store.prototype.hotUpdate = function hotUpdate (newOptions) {
   Store.prototype.hotUpdate = function hotUpdate (newOptions) {
     this._modules.update(newOptions);
     this._modules.update(newOptions);
     resetStore(this, true);
     resetStore(this, true);
@@ -1044,7 +1065,7 @@
   var index = {
   var index = {
     Store: Store,
     Store: Store,
     install: install,
     install: install,
-    version: '3.1.3',
+    version: '3.2.0',
     mapState: mapState,
     mapState: mapState,
     mapMutations: mapMutations,
     mapMutations: mapMutations,
     mapGetters: mapGetters,
     mapGetters: mapGetters,

File diff suppressed because it is too large
+ 1 - 1
dist/vuex.min.js


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "vuex",
   "name": "vuex",
-  "version": "3.1.3",
+  "version": "3.2.0",
   "description": "state management for Vue.js",
   "description": "state management for Vue.js",
   "main": "dist/vuex.common.js",
   "main": "dist/vuex.common.js",
   "module": "dist/vuex.esm.js",
   "module": "dist/vuex.esm.js",

Some files were not shown because too many files changed in this diff