@dcloudio/vue-cli-plugin-uni 2.0.0 → 2.0.1-32920211122002

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/commands/build.js +64 -33
  2. package/commands/serve.js +12 -17
  3. package/generator.js +6 -2
  4. package/index.js +5 -3
  5. package/lib/chain-webpack.js +8 -1
  6. package/lib/check-update.js +56 -0
  7. package/lib/commands/custom.js +7 -4
  8. package/lib/commands/invoke.js +5 -4
  9. package/lib/configure-webpack.js +35 -5
  10. package/lib/copy-webpack-options.js +60 -20
  11. package/lib/env.js +99 -51
  12. package/lib/error-reporting.js +9 -3
  13. package/lib/mp/index.js +31 -16
  14. package/lib/options.js +6 -3
  15. package/lib/util.js +5 -6
  16. package/package.json +3 -3
  17. package/packages/@vue/component-compiler-utils/MODIFY.md +5 -0
  18. package/packages/@vue/component-compiler-utils/dist/compileStyle.js +11 -0
  19. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/API.md +873 -0
  20. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/CHANGELOG.md +466 -0
  21. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/LICENSE-MIT +22 -0
  22. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/README.md +49 -0
  23. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/index.js +26 -0
  24. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/parser.js +1088 -0
  25. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/processor.js +185 -0
  26. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/attribute.js +468 -0
  27. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/className.js +67 -0
  28. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/combinator.js +35 -0
  29. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/comment.js +35 -0
  30. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/constructors.js +91 -0
  31. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/container.js +392 -0
  32. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/guards.js +54 -0
  33. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/id.js +39 -0
  34. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/index.js +39 -0
  35. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/namespace.js +98 -0
  36. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/nesting.js +36 -0
  37. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/node.js +216 -0
  38. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/pseudo.js +40 -0
  39. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/root.js +60 -0
  40. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/selector.js +35 -0
  41. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/string.js +35 -0
  42. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/tag.js +35 -0
  43. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/types.js +15 -0
  44. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/selectors/universal.js +36 -0
  45. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/sortAscending.js +10 -0
  46. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/tokenTypes.js +39 -0
  47. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/tokenize.js +271 -0
  48. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/ensureObject.js +20 -0
  49. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/getProp.js +22 -0
  50. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/index.js +41 -0
  51. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/stripComments.js +21 -0
  52. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/dist/util/unesc.js +18 -0
  53. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/package.json +76 -0
  54. package/packages/@vue/component-compiler-utils/node_modules/postcss-selector-parser/postcss-selector-parser.d.ts +499 -0
  55. package/packages/@vue/devtools-api/lib/cjs/api/api.d.ts +90 -0
  56. package/packages/@vue/devtools-api/lib/cjs/api/api.js +2 -0
  57. package/packages/@vue/devtools-api/lib/cjs/api/app.d.ts +1 -0
  58. package/packages/@vue/devtools-api/lib/cjs/api/app.js +2 -0
  59. package/packages/@vue/devtools-api/lib/cjs/api/component.d.ts +76 -0
  60. package/packages/@vue/devtools-api/lib/cjs/api/component.js +2 -0
  61. package/packages/@vue/devtools-api/lib/cjs/api/context.d.ts +5 -0
  62. package/packages/@vue/devtools-api/lib/cjs/api/context.js +2 -0
  63. package/packages/@vue/devtools-api/lib/cjs/api/hooks.d.ts +169 -0
  64. package/packages/@vue/devtools-api/lib/cjs/api/hooks.js +2 -0
  65. package/packages/@vue/devtools-api/lib/cjs/api/index.d.ts +6 -0
  66. package/packages/@vue/devtools-api/lib/cjs/api/index.js +18 -0
  67. package/packages/@vue/devtools-api/lib/cjs/api/util.d.ts +4 -0
  68. package/packages/@vue/devtools-api/lib/cjs/api/util.js +2 -0
  69. package/packages/@vue/devtools-api/lib/cjs/const.d.ts +1 -0
  70. package/packages/@vue/devtools-api/lib/cjs/const.js +4 -0
  71. package/packages/@vue/devtools-api/lib/cjs/env.d.ts +10 -0
  72. package/packages/@vue/devtools-api/lib/cjs/env.js +16 -0
  73. package/packages/@vue/devtools-api/lib/cjs/index.d.ts +14 -0
  74. package/packages/@vue/devtools-api/lib/cjs/index.js +31 -0
  75. package/packages/@vue/devtools-api/lib/esm/api/api.js +0 -0
  76. package/packages/@vue/devtools-api/lib/esm/api/app.js +0 -0
  77. package/packages/@vue/devtools-api/lib/esm/api/component.js +0 -0
  78. package/packages/@vue/devtools-api/lib/esm/api/context.js +0 -0
  79. package/packages/@vue/devtools-api/lib/esm/api/hooks.js +0 -0
  80. package/packages/@vue/devtools-api/lib/esm/api/index.js +6 -0
  81. package/packages/@vue/devtools-api/lib/esm/api/util.js +0 -0
  82. package/packages/@vue/devtools-api/lib/esm/const.js +1 -0
  83. package/packages/@vue/devtools-api/lib/esm/env.js +11 -0
  84. package/packages/@vue/devtools-api/lib/esm/index.js +17 -0
  85. package/packages/@vue/devtools-api/package.json +38 -0
  86. package/packages/app-vue-style-loader/lib/addStylesClient.js +1 -1
  87. package/packages/h5-vue-style-loader/lib/addStylesClient.js +1 -1
  88. package/packages/mp-vue/dist/mp.runtime.esm.js +3 -2
  89. package/packages/mp-vue/package.json +1 -0
  90. package/packages/uni-app/LICENSE +202 -0
  91. package/packages/uni-app/dist/uni-app.cjs.js +165 -0
  92. package/packages/uni-app/dist/uni-app.d.ts +61 -0
  93. package/packages/uni-app/dist/uni-app.es.js +108 -0
  94. package/packages/uni-app/package.json +22 -0
  95. package/packages/uni-cloud/dist/index.js +1 -1
  96. package/packages/uni-stat/dist/uni-stat.cjs.js +961 -0
  97. package/packages/uni-stat/dist/uni-stat.es.js +959 -0
  98. package/packages/uni-stat/lib/uni.plugin.js +68 -0
  99. package/packages/uni-stat/package.json +25 -0
  100. package/packages/vue3/node_modules/.yarn-integrity +27 -0
  101. package/packages/vue3/node_modules/@intlify/core-base/LICENSE +20 -0
  102. package/packages/vue3/node_modules/@intlify/core-base/README.md +7 -0
  103. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.cjs.js +989 -0
  104. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.cjs.prod.js +735 -0
  105. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.d.ts +576 -0
  106. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.esm-browser.js +2771 -0
  107. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.esm-browser.prod.js +6 -0
  108. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.esm-bundler.js +965 -0
  109. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.global.js +2814 -0
  110. package/packages/vue3/node_modules/@intlify/core-base/dist/core-base.global.prod.js +6 -0
  111. package/packages/vue3/node_modules/@intlify/core-base/index.js +7 -0
  112. package/packages/vue3/node_modules/@intlify/core-base/package.json +59 -0
  113. package/packages/vue3/node_modules/@intlify/devtools-if/LICENSE +20 -0
  114. package/packages/vue3/node_modules/@intlify/devtools-if/README.md +13 -0
  115. package/packages/vue3/node_modules/@intlify/devtools-if/dist/devtools-if.cjs.js +15 -0
  116. package/packages/vue3/node_modules/@intlify/devtools-if/dist/devtools-if.cjs.prod.js +15 -0
  117. package/packages/vue3/node_modules/@intlify/devtools-if/dist/devtools-if.d.ts +43 -0
  118. package/packages/vue3/node_modules/@intlify/devtools-if/dist/devtools-if.esm-bundler.js +11 -0
  119. package/packages/vue3/node_modules/@intlify/devtools-if/index.js +7 -0
  120. package/packages/vue3/node_modules/@intlify/devtools-if/package.json +49 -0
  121. package/packages/vue3/node_modules/@intlify/message-compiler/LICENSE +20 -0
  122. package/packages/vue3/node_modules/@intlify/message-compiler/README.md +7 -0
  123. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.cjs.js +1400 -0
  124. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.cjs.prod.js +1395 -0
  125. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.d.ts +197 -0
  126. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.esm-browser.js +1348 -0
  127. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.esm-browser.prod.js +6 -0
  128. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.esm-bundler.js +1329 -0
  129. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.global.js +1365 -0
  130. package/packages/vue3/node_modules/@intlify/message-compiler/dist/message-compiler.global.prod.js +6 -0
  131. package/packages/vue3/node_modules/@intlify/message-compiler/index.js +7 -0
  132. package/packages/vue3/node_modules/@intlify/message-compiler/package.json +56 -0
  133. package/packages/vue3/node_modules/@intlify/message-resolver/LICENSE +20 -0
  134. package/packages/vue3/node_modules/@intlify/message-resolver/README.md +7 -0
  135. package/packages/vue3/node_modules/@intlify/message-resolver/dist/message-resolver.cjs.js +302 -0
  136. package/packages/vue3/node_modules/@intlify/message-resolver/dist/message-resolver.cjs.prod.js +302 -0
  137. package/packages/vue3/node_modules/@intlify/message-resolver/dist/message-resolver.d.ts +21 -0
  138. package/packages/vue3/node_modules/@intlify/message-resolver/dist/message-resolver.esm-bundler.js +297 -0
  139. package/packages/vue3/node_modules/@intlify/message-resolver/index.js +7 -0
  140. package/packages/vue3/node_modules/@intlify/message-resolver/package.json +46 -0
  141. package/packages/vue3/node_modules/@intlify/runtime/LICENSE +20 -0
  142. package/packages/vue3/node_modules/@intlify/runtime/README.md +7 -0
  143. package/packages/vue3/node_modules/@intlify/runtime/dist/runtime.cjs.js +116 -0
  144. package/packages/vue3/node_modules/@intlify/runtime/dist/runtime.cjs.prod.js +116 -0
  145. package/packages/vue3/node_modules/@intlify/runtime/dist/runtime.d.ts +95 -0
  146. package/packages/vue3/node_modules/@intlify/runtime/dist/runtime.esm-bundler.js +111 -0
  147. package/packages/vue3/node_modules/@intlify/runtime/index.js +7 -0
  148. package/packages/vue3/node_modules/@intlify/runtime/package.json +51 -0
  149. package/packages/vue3/node_modules/@intlify/shared/LICENSE +20 -0
  150. package/packages/vue3/node_modules/@intlify/shared/README.md +18 -0
  151. package/packages/vue3/node_modules/@intlify/shared/dist/shared.cjs.js +222 -0
  152. package/packages/vue3/node_modules/@intlify/shared/dist/shared.cjs.prod.js +209 -0
  153. package/packages/vue3/node_modules/@intlify/shared/dist/shared.d.ts +145 -0
  154. package/packages/vue3/node_modules/@intlify/shared/dist/shared.esm-bundler.js +192 -0
  155. package/packages/vue3/node_modules/@intlify/shared/index.js +7 -0
  156. package/packages/vue3/node_modules/@intlify/shared/package.json +46 -0
  157. package/packages/vue3/node_modules/@intlify/vue-devtools/LICENSE +20 -0
  158. package/packages/vue3/node_modules/@intlify/vue-devtools/README.md +7 -0
  159. package/packages/vue3/node_modules/@intlify/vue-devtools/dist/vue-devtools.cjs.js +24 -0
  160. package/packages/vue3/node_modules/@intlify/vue-devtools/dist/vue-devtools.cjs.prod.js +24 -0
  161. package/packages/vue3/node_modules/@intlify/vue-devtools/dist/vue-devtools.d.ts +81 -0
  162. package/packages/vue3/node_modules/@intlify/vue-devtools/dist/vue-devtools.esm-bundler.js +18 -0
  163. package/packages/vue3/node_modules/@intlify/vue-devtools/index.js +7 -0
  164. package/packages/vue3/node_modules/@intlify/vue-devtools/package.json +51 -0
  165. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/api.d.ts +90 -0
  166. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/api.js +2 -0
  167. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/app.d.ts +1 -0
  168. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/app.js +2 -0
  169. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/component.d.ts +76 -0
  170. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/component.js +2 -0
  171. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/context.d.ts +5 -0
  172. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/context.js +2 -0
  173. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/hooks.d.ts +169 -0
  174. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/hooks.js +2 -0
  175. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/index.d.ts +6 -0
  176. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/index.js +18 -0
  177. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/util.d.ts +4 -0
  178. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/api/util.js +2 -0
  179. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/const.d.ts +1 -0
  180. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/const.js +4 -0
  181. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/env.d.ts +10 -0
  182. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/env.js +16 -0
  183. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/index.d.ts +14 -0
  184. package/packages/vue3/node_modules/@vue/devtools-api/lib/cjs/index.js +31 -0
  185. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/api.js +0 -0
  186. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/app.js +0 -0
  187. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/component.js +0 -0
  188. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/context.js +0 -0
  189. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/hooks.js +0 -0
  190. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/index.js +6 -0
  191. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/api/util.js +0 -0
  192. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/const.js +1 -0
  193. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/env.js +11 -0
  194. package/packages/vue3/node_modules/@vue/devtools-api/lib/esm/index.js +17 -0
  195. package/packages/vue3/node_modules/@vue/devtools-api/package.json +38 -0
  196. package/packages/vue3/node_modules/source-map/CHANGELOG.md +301 -0
  197. package/packages/vue3/node_modules/source-map/LICENSE +28 -0
  198. package/packages/vue3/node_modules/source-map/README.md +742 -0
  199. package/packages/vue3/node_modules/source-map/dist/source-map.debug.js +3234 -0
  200. package/packages/vue3/node_modules/source-map/dist/source-map.js +3233 -0
  201. package/packages/vue3/node_modules/source-map/dist/source-map.min.js +2 -0
  202. package/packages/vue3/node_modules/source-map/dist/source-map.min.js.map +1 -0
  203. package/packages/vue3/node_modules/source-map/lib/array-set.js +121 -0
  204. package/packages/vue3/node_modules/source-map/lib/base64-vlq.js +140 -0
  205. package/packages/vue3/node_modules/source-map/lib/base64.js +67 -0
  206. package/packages/vue3/node_modules/source-map/lib/binary-search.js +111 -0
  207. package/packages/vue3/node_modules/source-map/lib/mapping-list.js +79 -0
  208. package/packages/vue3/node_modules/source-map/lib/quick-sort.js +114 -0
  209. package/packages/vue3/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  210. package/packages/vue3/node_modules/source-map/lib/source-map-generator.js +425 -0
  211. package/packages/vue3/node_modules/source-map/lib/source-node.js +413 -0
  212. package/packages/vue3/node_modules/source-map/lib/util.js +488 -0
  213. package/packages/vue3/node_modules/source-map/package.json +73 -0
  214. package/packages/vue3/node_modules/source-map/source-map.d.ts +98 -0
  215. package/packages/vue3/node_modules/source-map/source-map.js +8 -0
  216. package/packages/vue3/node_modules/vue-i18n/LICENSE +20 -0
  217. package/packages/vue3/node_modules/vue-i18n/README.md +74 -0
  218. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.cjs.js +1801 -0
  219. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.cjs.prod.js +1685 -0
  220. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.d.ts +3302 -0
  221. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.esm-browser.js +5052 -0
  222. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.esm-browser.prod.js +6 -0
  223. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.esm-bundler.js +2226 -0
  224. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.global.js +5065 -0
  225. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.global.prod.js +6 -0
  226. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.runtime.esm-browser.js +3724 -0
  227. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.runtime.esm-browser.prod.js +6 -0
  228. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js +2224 -0
  229. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.runtime.global.js +3737 -0
  230. package/packages/vue3/node_modules/vue-i18n/dist/vue-i18n.runtime.global.prod.js +6 -0
  231. package/packages/vue3/node_modules/vue-i18n/index.js +7 -0
  232. package/packages/vue3/node_modules/vue-i18n/package.json +69 -0
  233. package/packages/vue3/node_modules/vue-i18n/vetur/attributes.json +62 -0
  234. package/packages/vue3/node_modules/vue-i18n/vetur/tags.json +14 -0
  235. package/packages/vue3/package.json +15 -0
  236. package/packages/vue3/yarn.lock +79 -0
  237. package/packages/vuex/CHANGELOG.md +604 -0
  238. package/packages/vuex/LICENSE +21 -0
  239. package/packages/vuex/README.md +55 -0
  240. package/packages/vuex/dist/vuex.cjs.js +1474 -0
  241. package/packages/vuex/dist/vuex.esm-browser.js +1472 -0
  242. package/packages/vuex/dist/vuex.esm-browser.prod.js +1307 -0
  243. package/packages/vuex/dist/vuex.esm-bundler.js +1473 -0
  244. package/packages/vuex/dist/vuex.global.js +1499 -0
  245. package/packages/vuex/dist/vuex.global.prod.js +6 -0
  246. package/packages/vuex/dist/vuex.mjs +32 -0
  247. package/packages/vuex/package.json +99 -0
  248. package/packages/vuex/types/helpers.d.ts +86 -0
  249. package/packages/vuex/types/index.d.ts +167 -0
  250. package/packages/vuex/types/logger.d.ts +20 -0
  251. package/packages/vuex/types/vue.d.ts +12 -0
  252. package/packages/vuex3/CHANGELOG.md +356 -0
  253. package/packages/vuex3/LICENSE +21 -0
  254. package/packages/vuex3/README.md +59 -0
  255. package/packages/vuex3/dist/logger.js +155 -0
  256. package/packages/vuex3/dist/vuex.common.js +1244 -0
  257. package/packages/vuex3/dist/vuex.esm.browser.js +1200 -0
  258. package/packages/vuex3/dist/vuex.esm.browser.min.js +6 -0
  259. package/packages/vuex3/dist/vuex.esm.js +1243 -0
  260. package/packages/vuex3/dist/vuex.js +1250 -0
  261. package/packages/vuex3/dist/vuex.min.js +6 -0
  262. package/packages/vuex3/dist/vuex.mjs +26 -0
  263. package/packages/vuex3/package.json +96 -0
  264. package/packages/vuex3/types/helpers.d.ts +86 -0
  265. package/packages/vuex3/types/index.d.ts +164 -0
  266. package/packages/vuex3/types/logger.d.ts +20 -0
  267. package/packages/vuex3/types/vue.d.ts +18 -0
  268. package/packages/webpack-uni-app-loader/plugin/index.js +8 -2
  269. package/packages/webpack-uni-app-loader/view/main.js +12 -0
@@ -0,0 +1,1474 @@
1
+ /*!
2
+ * vuex v4.0.2
3
+ * (c) 2021 Evan You
4
+ * @license MIT
5
+ */
6
+ 'use strict'
7
+
8
+ var vue = require('vue')
9
+ var devtoolsApi = require('@vue/devtools-api')
10
+
11
+ var storeKey = 'store'
12
+
13
+ function useStore (key) {
14
+ if (key === void 0) key = null
15
+
16
+ return vue.inject(key !== null ? key : storeKey)
17
+ }
18
+
19
+ /**
20
+ * Get the first item that pass the test
21
+ * by second argument function
22
+ *
23
+ * @param {Array} list
24
+ * @param {Function} f
25
+ * @return {*}
26
+ */
27
+ function find (list, f) {
28
+ return list.filter(f)[0]
29
+ }
30
+
31
+ /**
32
+ * Deep copy the given object considering circular structure.
33
+ * This function caches all nested objects and its copies.
34
+ * If it detects circular structure, use cached copy to avoid infinite loop.
35
+ *
36
+ * @param {*} obj
37
+ * @param {Array<Object>} cache
38
+ * @return {*}
39
+ */
40
+ function deepCopy (obj, cache) {
41
+ if (cache === void 0) cache = []
42
+
43
+ // just return if obj is immutable value
44
+ if (obj === null || typeof obj !== 'object') {
45
+ return obj
46
+ }
47
+
48
+ // if obj is hit, it is in circular structure
49
+ var hit = find(cache, function (c) { return c.original === obj })
50
+ if (hit) {
51
+ return hit.copy
52
+ }
53
+
54
+ var copy = Array.isArray(obj) ? [] : {}
55
+ // put the copy into cache at first
56
+ // because we want to refer it in recursive deepCopy
57
+ cache.push({
58
+ original: obj,
59
+ copy: copy
60
+ })
61
+
62
+ Object.keys(obj).forEach(function (key) {
63
+ copy[key] = deepCopy(obj[key], cache)
64
+ })
65
+
66
+ return copy
67
+ }
68
+
69
+ /**
70
+ * forEach for object
71
+ */
72
+ function forEachValue (obj, fn) {
73
+ Object.keys(obj).forEach(function (key) { return fn(obj[key], key) })
74
+ }
75
+
76
+ function isObject (obj) {
77
+ return obj !== null && typeof obj === 'object'
78
+ }
79
+
80
+ function isPromise (val) {
81
+ return val && typeof val.then === 'function'
82
+ }
83
+
84
+ function assert (condition, msg) {
85
+ if (!condition) { throw new Error(('[vuex] ' + msg)) }
86
+ }
87
+
88
+ function partial (fn, arg) {
89
+ return function () {
90
+ return fn(arg)
91
+ }
92
+ }
93
+
94
+ function genericSubscribe (fn, subs, options) {
95
+ if (subs.indexOf(fn) < 0) {
96
+ options && options.prepend
97
+ ? subs.unshift(fn)
98
+ : subs.push(fn)
99
+ }
100
+ return function () {
101
+ var i = subs.indexOf(fn)
102
+ if (i > -1) {
103
+ subs.splice(i, 1)
104
+ }
105
+ }
106
+ }
107
+
108
+ function resetStore (store, hot) {
109
+ store._actions = Object.create(null)
110
+ store._mutations = Object.create(null)
111
+ store._wrappedGetters = Object.create(null)
112
+ store._modulesNamespaceMap = Object.create(null)
113
+ var state = store.state
114
+ // init all modules
115
+ installModule(store, state, [], store._modules.root, true)
116
+ // reset state
117
+ resetStoreState(store, state, hot)
118
+ }
119
+
120
+ function resetStoreState (store, state, hot) {
121
+ var oldState = store._state
122
+
123
+ // bind store public getters
124
+ store.getters = {}
125
+ // reset local getters cache
126
+ store._makeLocalGettersCache = Object.create(null)
127
+ var wrappedGetters = store._wrappedGetters
128
+ var computedObj = {}
129
+ forEachValue(wrappedGetters, function (fn, key) {
130
+ // use computed to leverage its lazy-caching mechanism
131
+ // direct inline function use will lead to closure preserving oldState.
132
+ // using partial to return function with only arguments preserved in closure environment.
133
+ computedObj[key] = partial(fn, store)
134
+ Object.defineProperty(store.getters, key, {
135
+ // TODO: use `computed` when it's possible. at the moment we can't due to
136
+ // https://github.com/vuejs/vuex/pull/1883
137
+ get: function () { return computedObj[key]() },
138
+ enumerable: true // for local getters
139
+ })
140
+ })
141
+
142
+ store._state = vue.reactive({
143
+ data: state
144
+ })
145
+
146
+ // enable strict mode for new state
147
+ if (store.strict) {
148
+ enableStrictMode(store)
149
+ }
150
+
151
+ if (oldState) {
152
+ if (hot) {
153
+ // dispatch changes in all subscribed watchers
154
+ // to force getter re-evaluation for hot reloading.
155
+ store._withCommit(function () {
156
+ oldState.data = null
157
+ })
158
+ }
159
+ }
160
+ }
161
+
162
+ function installModule (store, rootState, path, module, hot) {
163
+ var isRoot = !path.length
164
+ var namespace = store._modules.getNamespace(path)
165
+
166
+ // register in namespace map
167
+ if (module.namespaced) {
168
+ if (store._modulesNamespaceMap[namespace] && (process.env.NODE_ENV !== 'production')) {
169
+ console.error(('[vuex] duplicate namespace ' + namespace + ' for the namespaced module ' + (path.join('/'))))
170
+ }
171
+ store._modulesNamespaceMap[namespace] = module
172
+ }
173
+
174
+ // set state
175
+ if (!isRoot && !hot) {
176
+ var parentState = getNestedState(rootState, path.slice(0, -1))
177
+ var moduleName = path[path.length - 1]
178
+ store._withCommit(function () {
179
+ if ((process.env.NODE_ENV !== 'production')) {
180
+ if (moduleName in parentState) {
181
+ console.warn(
182
+ ('[vuex] state field "' + moduleName + '" was overridden by a module with the same name at "' + (path.join('.')) + '"')
183
+ )
184
+ }
185
+ }
186
+ parentState[moduleName] = module.state
187
+ })
188
+ }
189
+
190
+ var local = module.context = makeLocalContext(store, namespace, path)
191
+
192
+ module.forEachMutation(function (mutation, key) {
193
+ var namespacedType = namespace + key
194
+ registerMutation(store, namespacedType, mutation, local)
195
+ })
196
+
197
+ module.forEachAction(function (action, key) {
198
+ var type = action.root ? key : namespace + key
199
+ var handler = action.handler || action
200
+ registerAction(store, type, handler, local)
201
+ })
202
+
203
+ module.forEachGetter(function (getter, key) {
204
+ var namespacedType = namespace + key
205
+ registerGetter(store, namespacedType, getter, local)
206
+ })
207
+
208
+ module.forEachChild(function (child, key) {
209
+ installModule(store, rootState, path.concat(key), child, hot)
210
+ })
211
+ }
212
+
213
+ /**
214
+ * make localized dispatch, commit, getters and state
215
+ * if there is no namespace, just use root ones
216
+ */
217
+ function makeLocalContext (store, namespace, path) {
218
+ var noNamespace = namespace === ''
219
+
220
+ var local = {
221
+ dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
222
+ var args = unifyObjectStyle(_type, _payload, _options)
223
+ var payload = args.payload
224
+ var options = args.options
225
+ var type = args.type
226
+
227
+ if (!options || !options.root) {
228
+ type = namespace + type
229
+ if ((process.env.NODE_ENV !== 'production') && !store._actions[type]) {
230
+ console.error(('[vuex] unknown local action type: ' + (args.type) + ', global type: ' + type))
231
+ return
232
+ }
233
+ }
234
+
235
+ return store.dispatch(type, payload)
236
+ },
237
+
238
+ commit: noNamespace ? store.commit : function (_type, _payload, _options) {
239
+ var args = unifyObjectStyle(_type, _payload, _options)
240
+ var payload = args.payload
241
+ var options = args.options
242
+ var type = args.type
243
+
244
+ if (!options || !options.root) {
245
+ type = namespace + type
246
+ if ((process.env.NODE_ENV !== 'production') && !store._mutations[type]) {
247
+ console.error(('[vuex] unknown local mutation type: ' + (args.type) + ', global type: ' + type))
248
+ return
249
+ }
250
+ }
251
+
252
+ store.commit(type, payload, options)
253
+ }
254
+ }
255
+
256
+ // getters and state object must be gotten lazily
257
+ // because they will be changed by state update
258
+ Object.defineProperties(local, {
259
+ getters: {
260
+ get: noNamespace
261
+ ? function () { return store.getters }
262
+ : function () { return makeLocalGetters(store, namespace) }
263
+ },
264
+ state: {
265
+ get: function () { return getNestedState(store.state, path) }
266
+ }
267
+ })
268
+
269
+ return local
270
+ }
271
+
272
+ function makeLocalGetters (store, namespace) {
273
+ if (!store._makeLocalGettersCache[namespace]) {
274
+ var gettersProxy = {}
275
+ var splitPos = namespace.length
276
+ Object.keys(store.getters).forEach(function (type) {
277
+ // skip if the target getter is not match this namespace
278
+ if (type.slice(0, splitPos) !== namespace) { return }
279
+
280
+ // extract local getter type
281
+ var localType = type.slice(splitPos)
282
+
283
+ // Add a port to the getters proxy.
284
+ // Define as getter property because
285
+ // we do not want to evaluate the getters in this time.
286
+ Object.defineProperty(gettersProxy, localType, {
287
+ get: function () { return store.getters[type] },
288
+ enumerable: true
289
+ })
290
+ })
291
+ store._makeLocalGettersCache[namespace] = gettersProxy
292
+ }
293
+
294
+ return store._makeLocalGettersCache[namespace]
295
+ }
296
+
297
+ function registerMutation (store, type, handler, local) {
298
+ var entry = store._mutations[type] || (store._mutations[type] = [])
299
+ entry.push(function wrappedMutationHandler (payload) {
300
+ handler.call(store, local.state, payload)
301
+ })
302
+ }
303
+
304
+ function registerAction (store, type, handler, local) {
305
+ var entry = store._actions[type] || (store._actions[type] = [])
306
+ entry.push(function wrappedActionHandler (payload) {
307
+ var res = handler.call(store, {
308
+ dispatch: local.dispatch,
309
+ commit: local.commit,
310
+ getters: local.getters,
311
+ state: local.state,
312
+ rootGetters: store.getters,
313
+ rootState: store.state
314
+ }, payload)
315
+ if (!isPromise(res)) {
316
+ res = Promise.resolve(res)
317
+ }
318
+ if (store._devtoolHook) {
319
+ return res.catch(function (err) {
320
+ store._devtoolHook.emit('vuex:error', err)
321
+ throw err
322
+ })
323
+ } else {
324
+ return res
325
+ }
326
+ })
327
+ }
328
+
329
+ function registerGetter (store, type, rawGetter, local) {
330
+ if (store._wrappedGetters[type]) {
331
+ if ((process.env.NODE_ENV !== 'production')) {
332
+ console.error(('[vuex] duplicate getter key: ' + type))
333
+ }
334
+ return
335
+ }
336
+ store._wrappedGetters[type] = function wrappedGetter (store) {
337
+ return rawGetter(
338
+ local.state, // local state
339
+ local.getters, // local getters
340
+ store.state, // root state
341
+ store.getters // root getters
342
+ )
343
+ }
344
+ }
345
+
346
+ function enableStrictMode (store) {
347
+ vue.watch(function () { return store._state.data }, function () {
348
+ if ((process.env.NODE_ENV !== 'production')) {
349
+ assert(store._committing, 'do not mutate vuex store state outside mutation handlers.')
350
+ }
351
+ }, { deep: true, flush: 'sync' })
352
+ }
353
+
354
+ function getNestedState (state, path) {
355
+ return path.reduce(function (state, key) { return state[key] }, state)
356
+ }
357
+
358
+ function unifyObjectStyle (type, payload, options) {
359
+ if (isObject(type) && type.type) {
360
+ options = payload
361
+ payload = type
362
+ type = type.type
363
+ }
364
+
365
+ if ((process.env.NODE_ENV !== 'production')) {
366
+ assert(typeof type === 'string', ('expects string as the type, but found ' + (typeof type) + '.'))
367
+ }
368
+
369
+ return { type: type, payload: payload, options: options }
370
+ }
371
+
372
+ var LABEL_VUEX_BINDINGS = 'vuex bindings'
373
+ var MUTATIONS_LAYER_ID = 'vuex:mutations'
374
+ var ACTIONS_LAYER_ID = 'vuex:actions'
375
+ var INSPECTOR_ID = 'vuex'
376
+
377
+ var actionId = 0
378
+
379
+ function addDevtools (app, store) {
380
+ devtoolsApi.setupDevtoolsPlugin(
381
+ {
382
+ id: 'org.vuejs.vuex',
383
+ app: app,
384
+ label: 'Vuex',
385
+ homepage: 'https://next.vuex.vuejs.org/',
386
+ logo: 'https://vuejs.org/images/icons/favicon-96x96.png',
387
+ packageName: 'vuex',
388
+ componentStateTypes: [LABEL_VUEX_BINDINGS]
389
+ },
390
+ function (api) {
391
+ api.addTimelineLayer({
392
+ id: MUTATIONS_LAYER_ID,
393
+ label: 'Vuex Mutations',
394
+ color: COLOR_LIME_500
395
+ })
396
+
397
+ api.addTimelineLayer({
398
+ id: ACTIONS_LAYER_ID,
399
+ label: 'Vuex Actions',
400
+ color: COLOR_LIME_500
401
+ })
402
+
403
+ api.addInspector({
404
+ id: INSPECTOR_ID,
405
+ label: 'Vuex',
406
+ icon: 'storage',
407
+ treeFilterPlaceholder: 'Filter stores...'
408
+ })
409
+
410
+ api.on.getInspectorTree(function (payload) {
411
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
412
+ if (payload.filter) {
413
+ var nodes = []
414
+ flattenStoreForInspectorTree(nodes, store._modules.root, payload.filter, '')
415
+ payload.rootNodes = nodes
416
+ } else {
417
+ payload.rootNodes = [
418
+ formatStoreForInspectorTree(store._modules.root, '')
419
+ ]
420
+ }
421
+ }
422
+ })
423
+
424
+ api.on.getInspectorState(function (payload) {
425
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
426
+ var modulePath = payload.nodeId
427
+ makeLocalGetters(store, modulePath)
428
+ payload.state = formatStoreForInspectorState(
429
+ getStoreModule(store._modules, modulePath),
430
+ modulePath === 'root' ? store.getters : store._makeLocalGettersCache,
431
+ modulePath
432
+ )
433
+ }
434
+ })
435
+
436
+ api.on.editInspectorState(function (payload) {
437
+ if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
438
+ var modulePath = payload.nodeId
439
+ var path = payload.path
440
+ if (modulePath !== 'root') {
441
+ path = modulePath.split('/').filter(Boolean).concat(path)
442
+ }
443
+ store._withCommit(function () {
444
+ payload.set(store._state.data, path, payload.state.value)
445
+ })
446
+ }
447
+ })
448
+
449
+ store.subscribe(function (mutation, state) {
450
+ var data = {}
451
+
452
+ if (mutation.payload) {
453
+ data.payload = mutation.payload
454
+ }
455
+
456
+ data.state = state
457
+
458
+ api.notifyComponentUpdate()
459
+ api.sendInspectorTree(INSPECTOR_ID)
460
+ api.sendInspectorState(INSPECTOR_ID)
461
+
462
+ api.addTimelineEvent({
463
+ layerId: MUTATIONS_LAYER_ID,
464
+ event: {
465
+ time: Date.now(),
466
+ title: mutation.type,
467
+ data: data
468
+ }
469
+ })
470
+ })
471
+
472
+ store.subscribeAction({
473
+ before: function (action, state) {
474
+ var data = {}
475
+ if (action.payload) {
476
+ data.payload = action.payload
477
+ }
478
+ action._id = actionId++
479
+ action._time = Date.now()
480
+ data.state = state
481
+
482
+ api.addTimelineEvent({
483
+ layerId: ACTIONS_LAYER_ID,
484
+ event: {
485
+ time: action._time,
486
+ title: action.type,
487
+ groupId: action._id,
488
+ subtitle: 'start',
489
+ data: data
490
+ }
491
+ })
492
+ },
493
+ after: function (action, state) {
494
+ var data = {}
495
+ var duration = Date.now() - action._time
496
+ data.duration = {
497
+ _custom: {
498
+ type: 'duration',
499
+ display: (duration + 'ms'),
500
+ tooltip: 'Action duration',
501
+ value: duration
502
+ }
503
+ }
504
+ if (action.payload) {
505
+ data.payload = action.payload
506
+ }
507
+ data.state = state
508
+
509
+ api.addTimelineEvent({
510
+ layerId: ACTIONS_LAYER_ID,
511
+ event: {
512
+ time: Date.now(),
513
+ title: action.type,
514
+ groupId: action._id,
515
+ subtitle: 'end',
516
+ data: data
517
+ }
518
+ })
519
+ }
520
+ })
521
+ }
522
+ )
523
+ }
524
+
525
+ // extracted from tailwind palette
526
+ var COLOR_LIME_500 = 0x84cc16
527
+ var COLOR_DARK = 0x666666
528
+ var COLOR_WHITE = 0xffffff
529
+
530
+ var TAG_NAMESPACED = {
531
+ label: 'namespaced',
532
+ textColor: COLOR_WHITE,
533
+ backgroundColor: COLOR_DARK
534
+ }
535
+
536
+ /**
537
+ * @param {string} path
538
+ */
539
+ function extractNameFromPath (path) {
540
+ return path && path !== 'root' ? path.split('/').slice(-2, -1)[0] : 'Root'
541
+ }
542
+
543
+ /**
544
+ * @param {*} module
545
+ * @return {import('@vue/devtools-api').CustomInspectorNode}
546
+ */
547
+ function formatStoreForInspectorTree (module, path) {
548
+ return {
549
+ id: path || 'root',
550
+ // all modules end with a `/`, we want the last segment only
551
+ // cart/ -> cart
552
+ // nested/cart/ -> cart
553
+ label: extractNameFromPath(path),
554
+ tags: module.namespaced ? [TAG_NAMESPACED] : [],
555
+ children: Object.keys(module._children).map(function (moduleName) {
556
+ return formatStoreForInspectorTree(
557
+ module._children[moduleName],
558
+ path + moduleName + '/'
559
+ )
560
+ }
561
+ )
562
+ }
563
+ }
564
+
565
+ /**
566
+ * @param {import('@vue/devtools-api').CustomInspectorNode[]} result
567
+ * @param {*} module
568
+ * @param {string} filter
569
+ * @param {string} path
570
+ */
571
+ function flattenStoreForInspectorTree (result, module, filter, path) {
572
+ if (path.includes(filter)) {
573
+ result.push({
574
+ id: path || 'root',
575
+ label: path.endsWith('/') ? path.slice(0, path.length - 1) : path || 'Root',
576
+ tags: module.namespaced ? [TAG_NAMESPACED] : []
577
+ })
578
+ }
579
+ Object.keys(module._children).forEach(function (moduleName) {
580
+ flattenStoreForInspectorTree(result, module._children[moduleName], filter, path + moduleName + '/')
581
+ })
582
+ }
583
+
584
+ /**
585
+ * @param {*} module
586
+ * @return {import('@vue/devtools-api').CustomInspectorState}
587
+ */
588
+ function formatStoreForInspectorState (module, getters, path) {
589
+ getters = path === 'root' ? getters : getters[path]
590
+ var gettersKeys = Object.keys(getters)
591
+ var storeState = {
592
+ state: Object.keys(module.state).map(function (key) {
593
+ return ({
594
+ key: key,
595
+ editable: true,
596
+ value: module.state[key]
597
+ })
598
+ })
599
+ }
600
+
601
+ if (gettersKeys.length) {
602
+ var tree = transformPathsToObjectTree(getters)
603
+ storeState.getters = Object.keys(tree).map(function (key) {
604
+ return ({
605
+ key: key.endsWith('/') ? extractNameFromPath(key) : key,
606
+ editable: false,
607
+ value: canThrow(function () { return tree[key] })
608
+ })
609
+ })
610
+ }
611
+
612
+ return storeState
613
+ }
614
+
615
+ function transformPathsToObjectTree (getters) {
616
+ var result = {}
617
+ Object.keys(getters).forEach(function (key) {
618
+ var path = key.split('/')
619
+ if (path.length > 1) {
620
+ var target = result
621
+ var leafKey = path.pop()
622
+ path.forEach(function (p) {
623
+ if (!target[p]) {
624
+ target[p] = {
625
+ _custom: {
626
+ value: {},
627
+ display: p,
628
+ tooltip: 'Module',
629
+ abstract: true
630
+ }
631
+ }
632
+ }
633
+ target = target[p]._custom.value
634
+ })
635
+ target[leafKey] = canThrow(function () { return getters[key] })
636
+ } else {
637
+ result[key] = canThrow(function () { return getters[key] })
638
+ }
639
+ })
640
+ return result
641
+ }
642
+
643
+ function getStoreModule (moduleMap, path) {
644
+ var names = path.split('/').filter(function (n) { return n })
645
+ return names.reduce(
646
+ function (module, moduleName, i) {
647
+ var child = module[moduleName]
648
+ if (!child) {
649
+ throw new Error(('Missing module "' + moduleName + '" for path "' + path + '".'))
650
+ }
651
+ return i === names.length - 1 ? child : child._children
652
+ },
653
+ path === 'root' ? moduleMap : moduleMap.root._children
654
+ )
655
+ }
656
+
657
+ function canThrow (cb) {
658
+ try {
659
+ return cb()
660
+ } catch (e) {
661
+ return e
662
+ }
663
+ }
664
+
665
+ // Base data struct for store's module, package with some attribute and method
666
+ var Module = function Module (rawModule, runtime) {
667
+ this.runtime = runtime
668
+ // Store some children item
669
+ this._children = Object.create(null)
670
+ // Store the origin module object which passed by programmer
671
+ this._rawModule = rawModule
672
+ var rawState = rawModule.state
673
+
674
+ // Store the origin module's state
675
+ this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}
676
+ }
677
+
678
+ var prototypeAccessors$1 = { namespaced: { configurable: true } }
679
+
680
+ prototypeAccessors$1.namespaced.get = function () {
681
+ return !!this._rawModule.namespaced
682
+ }
683
+
684
+ Module.prototype.addChild = function addChild (key, module) {
685
+ this._children[key] = module
686
+ }
687
+
688
+ Module.prototype.removeChild = function removeChild (key) {
689
+ delete this._children[key]
690
+ }
691
+
692
+ Module.prototype.getChild = function getChild (key) {
693
+ return this._children[key]
694
+ }
695
+
696
+ Module.prototype.hasChild = function hasChild (key) {
697
+ return key in this._children
698
+ }
699
+
700
+ Module.prototype.update = function update (rawModule) {
701
+ this._rawModule.namespaced = rawModule.namespaced
702
+ if (rawModule.actions) {
703
+ this._rawModule.actions = rawModule.actions
704
+ }
705
+ if (rawModule.mutations) {
706
+ this._rawModule.mutations = rawModule.mutations
707
+ }
708
+ if (rawModule.getters) {
709
+ this._rawModule.getters = rawModule.getters
710
+ }
711
+ }
712
+
713
+ Module.prototype.forEachChild = function forEachChild (fn) {
714
+ forEachValue(this._children, fn)
715
+ }
716
+
717
+ Module.prototype.forEachGetter = function forEachGetter (fn) {
718
+ if (this._rawModule.getters) {
719
+ forEachValue(this._rawModule.getters, fn)
720
+ }
721
+ }
722
+
723
+ Module.prototype.forEachAction = function forEachAction (fn) {
724
+ if (this._rawModule.actions) {
725
+ forEachValue(this._rawModule.actions, fn)
726
+ }
727
+ }
728
+
729
+ Module.prototype.forEachMutation = function forEachMutation (fn) {
730
+ if (this._rawModule.mutations) {
731
+ forEachValue(this._rawModule.mutations, fn)
732
+ }
733
+ }
734
+
735
+ Object.defineProperties(Module.prototype, prototypeAccessors$1)
736
+
737
+ var ModuleCollection = function ModuleCollection (rawRootModule) {
738
+ // register root module (Vuex.Store options)
739
+ this.register([], rawRootModule, false)
740
+ }
741
+
742
+ ModuleCollection.prototype.get = function get (path) {
743
+ return path.reduce(function (module, key) {
744
+ return module.getChild(key)
745
+ }, this.root)
746
+ }
747
+
748
+ ModuleCollection.prototype.getNamespace = function getNamespace (path) {
749
+ var module = this.root
750
+ return path.reduce(function (namespace, key) {
751
+ module = module.getChild(key)
752
+ return namespace + (module.namespaced ? key + '/' : '')
753
+ }, '')
754
+ }
755
+
756
+ ModuleCollection.prototype.update = function update$1 (rawRootModule) {
757
+ update([], this.root, rawRootModule)
758
+ }
759
+
760
+ ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
761
+ var this$1$1 = this
762
+ if (runtime === void 0) runtime = true
763
+
764
+ if ((process.env.NODE_ENV !== 'production')) {
765
+ assertRawModule(path, rawModule)
766
+ }
767
+
768
+ var newModule = new Module(rawModule, runtime)
769
+ if (path.length === 0) {
770
+ this.root = newModule
771
+ } else {
772
+ var parent = this.get(path.slice(0, -1))
773
+ parent.addChild(path[path.length - 1], newModule)
774
+ }
775
+
776
+ // register nested modules
777
+ if (rawModule.modules) {
778
+ forEachValue(rawModule.modules, function (rawChildModule, key) {
779
+ this$1$1.register(path.concat(key), rawChildModule, runtime)
780
+ })
781
+ }
782
+ }
783
+
784
+ ModuleCollection.prototype.unregister = function unregister (path) {
785
+ var parent = this.get(path.slice(0, -1))
786
+ var key = path[path.length - 1]
787
+ var child = parent.getChild(key)
788
+
789
+ if (!child) {
790
+ if ((process.env.NODE_ENV !== 'production')) {
791
+ console.warn(
792
+ "[vuex] trying to unregister module '" + key + "', which is " +
793
+ 'not registered'
794
+ )
795
+ }
796
+ return
797
+ }
798
+
799
+ if (!child.runtime) {
800
+ return
801
+ }
802
+
803
+ parent.removeChild(key)
804
+ }
805
+
806
+ ModuleCollection.prototype.isRegistered = function isRegistered (path) {
807
+ var parent = this.get(path.slice(0, -1))
808
+ var key = path[path.length - 1]
809
+
810
+ if (parent) {
811
+ return parent.hasChild(key)
812
+ }
813
+
814
+ return false
815
+ }
816
+
817
+ function update (path, targetModule, newModule) {
818
+ if ((process.env.NODE_ENV !== 'production')) {
819
+ assertRawModule(path, newModule)
820
+ }
821
+
822
+ // update target module
823
+ targetModule.update(newModule)
824
+
825
+ // update nested modules
826
+ if (newModule.modules) {
827
+ for (var key in newModule.modules) {
828
+ if (!targetModule.getChild(key)) {
829
+ if ((process.env.NODE_ENV !== 'production')) {
830
+ console.warn(
831
+ "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
832
+ 'manual reload is needed'
833
+ )
834
+ }
835
+ return
836
+ }
837
+ update(
838
+ path.concat(key),
839
+ targetModule.getChild(key),
840
+ newModule.modules[key]
841
+ )
842
+ }
843
+ }
844
+ }
845
+
846
+ var functionAssert = {
847
+ assert: function (value) { return typeof value === 'function' },
848
+ expected: 'function'
849
+ }
850
+
851
+ var objectAssert = {
852
+ assert: function (value) {
853
+ return typeof value === 'function' ||
854
+ (typeof value === 'object' && typeof value.handler === 'function')
855
+ },
856
+ expected: 'function or object with "handler" function'
857
+ }
858
+
859
+ var assertTypes = {
860
+ getters: functionAssert,
861
+ mutations: functionAssert,
862
+ actions: objectAssert
863
+ }
864
+
865
+ function assertRawModule (path, rawModule) {
866
+ Object.keys(assertTypes).forEach(function (key) {
867
+ if (!rawModule[key]) { return }
868
+
869
+ var assertOptions = assertTypes[key]
870
+
871
+ forEachValue(rawModule[key], function (value, type) {
872
+ assert(
873
+ assertOptions.assert(value),
874
+ makeAssertionMessage(path, key, type, value, assertOptions.expected)
875
+ )
876
+ })
877
+ })
878
+ }
879
+
880
+ function makeAssertionMessage (path, key, type, value, expected) {
881
+ var buf = key + ' should be ' + expected + ' but "' + key + '.' + type + '"'
882
+ if (path.length > 0) {
883
+ buf += ' in module "' + (path.join('.')) + '"'
884
+ }
885
+ buf += ' is ' + (JSON.stringify(value)) + '.'
886
+ return buf
887
+ }
888
+
889
+ function createStore (options) {
890
+ return new Store(options)
891
+ }
892
+
893
+ var Store = function Store (options) {
894
+ var this$1$1 = this
895
+ if (options === void 0) options = {}
896
+
897
+ if ((process.env.NODE_ENV !== 'production')) {
898
+ assert(typeof Promise !== 'undefined', 'vuex requires a Promise polyfill in this browser.')
899
+ assert(this instanceof Store, 'store must be called with the new operator.')
900
+ }
901
+
902
+ var plugins = options.plugins; if (plugins === void 0) plugins = []
903
+ var strict = options.strict; if (strict === void 0) strict = false
904
+ var devtools = options.devtools
905
+
906
+ // store internal state
907
+ this._committing = false
908
+ this._actions = Object.create(null)
909
+ this._actionSubscribers = []
910
+ this._mutations = Object.create(null)
911
+ this._wrappedGetters = Object.create(null)
912
+ this._modules = new ModuleCollection(options)
913
+ this._modulesNamespaceMap = Object.create(null)
914
+ this._subscribers = []
915
+ this._makeLocalGettersCache = Object.create(null)
916
+ this._devtools = devtools
917
+
918
+ // bind commit and dispatch to self
919
+ var store = this
920
+ var ref = this
921
+ var dispatch = ref.dispatch
922
+ var commit = ref.commit
923
+ this.dispatch = function boundDispatch (type, payload) {
924
+ return dispatch.call(store, type, payload)
925
+ }
926
+ this.commit = function boundCommit (type, payload, options) {
927
+ return commit.call(store, type, payload, options)
928
+ }
929
+
930
+ // strict mode
931
+ this.strict = strict
932
+
933
+ var state = this._modules.root.state
934
+
935
+ // init root module.
936
+ // this also recursively registers all sub-modules
937
+ // and collects all module getters inside this._wrappedGetters
938
+ installModule(this, state, [], this._modules.root)
939
+
940
+ // initialize the store state, which is responsible for the reactivity
941
+ // (also registers _wrappedGetters as computed properties)
942
+ resetStoreState(this, state)
943
+
944
+ // apply plugins
945
+ plugins.forEach(function (plugin) { return plugin(this$1$1) })
946
+ }
947
+
948
+ var prototypeAccessors = { state: { configurable: true } }
949
+
950
+ Store.prototype.install = function install (app, injectKey) {
951
+ app.provide(injectKey || storeKey, this)
952
+ app.config.globalProperties.$store = this
953
+
954
+ // 浏览器Vue.js devTools插件 在小程序中不走此处逻辑
955
+ /* var useDevtools = this._devtools !== undefined
956
+ ? this._devtools
957
+ : (process.env.NODE_ENV !== 'production') || false
958
+
959
+ if (useDevtools) {
960
+ addDevtools(app, this)
961
+ } */
962
+ }
963
+
964
+ prototypeAccessors.state.get = function () {
965
+ return this._state.data
966
+ }
967
+
968
+ prototypeAccessors.state.set = function (v) {
969
+ if ((process.env.NODE_ENV !== 'production')) {
970
+ assert(false, 'use store.replaceState() to explicit replace store state.')
971
+ }
972
+ }
973
+
974
+ Store.prototype.commit = function commit (_type, _payload, _options) {
975
+ var this$1$1 = this
976
+
977
+ // check object-style commit
978
+ var ref = unifyObjectStyle(_type, _payload, _options)
979
+ var type = ref.type
980
+ var payload = ref.payload
981
+ var options = ref.options
982
+
983
+ var mutation = { type: type, payload: payload }
984
+ var entry = this._mutations[type]
985
+ if (!entry) {
986
+ if ((process.env.NODE_ENV !== 'production')) {
987
+ console.error(('[vuex] unknown mutation type: ' + type))
988
+ }
989
+ return
990
+ }
991
+ this._withCommit(function () {
992
+ entry.forEach(function commitIterator (handler) {
993
+ handler(payload)
994
+ })
995
+ })
996
+
997
+ this._subscribers
998
+ .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
999
+ .forEach(function (sub) { return sub(mutation, this$1$1.state) })
1000
+
1001
+ if (
1002
+ (process.env.NODE_ENV !== 'production') &&
1003
+ options && options.silent
1004
+ ) {
1005
+ console.warn(
1006
+ '[vuex] mutation type: ' + type + '. Silent option has been removed. ' +
1007
+ 'Use the filter functionality in the vue-devtools'
1008
+ )
1009
+ }
1010
+ }
1011
+
1012
+ Store.prototype.dispatch = function dispatch (_type, _payload) {
1013
+ var this$1$1 = this
1014
+
1015
+ // check object-style dispatch
1016
+ var ref = unifyObjectStyle(_type, _payload)
1017
+ var type = ref.type
1018
+ var payload = ref.payload
1019
+
1020
+ var action = { type: type, payload: payload }
1021
+ var entry = this._actions[type]
1022
+ if (!entry) {
1023
+ if ((process.env.NODE_ENV !== 'production')) {
1024
+ console.error(('[vuex] unknown action type: ' + type))
1025
+ }
1026
+ return
1027
+ }
1028
+
1029
+ try {
1030
+ this._actionSubscribers
1031
+ .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
1032
+ .filter(function (sub) { return sub.before })
1033
+ .forEach(function (sub) { return sub.before(action, this$1$1.state) })
1034
+ } catch (e) {
1035
+ if ((process.env.NODE_ENV !== 'production')) {
1036
+ console.warn('[vuex] error in before action subscribers: ')
1037
+ console.error(e)
1038
+ }
1039
+ }
1040
+
1041
+ var result = entry.length > 1
1042
+ ? Promise.all(entry.map(function (handler) { return handler(payload) }))
1043
+ : entry[0](payload)
1044
+
1045
+ return new Promise(function (resolve, reject) {
1046
+ result.then(function (res) {
1047
+ try {
1048
+ this$1$1._actionSubscribers
1049
+ .filter(function (sub) { return sub.after })
1050
+ .forEach(function (sub) { return sub.after(action, this$1$1.state) })
1051
+ } catch (e) {
1052
+ if ((process.env.NODE_ENV !== 'production')) {
1053
+ console.warn('[vuex] error in after action subscribers: ')
1054
+ console.error(e)
1055
+ }
1056
+ }
1057
+ resolve(res)
1058
+ }, function (error) {
1059
+ try {
1060
+ this$1$1._actionSubscribers
1061
+ .filter(function (sub) { return sub.error })
1062
+ .forEach(function (sub) { return sub.error(action, this$1$1.state, error) })
1063
+ } catch (e) {
1064
+ if ((process.env.NODE_ENV !== 'production')) {
1065
+ console.warn('[vuex] error in error action subscribers: ')
1066
+ console.error(e)
1067
+ }
1068
+ }
1069
+ reject(error)
1070
+ })
1071
+ })
1072
+ }
1073
+
1074
+ Store.prototype.subscribe = function subscribe (fn, options) {
1075
+ return genericSubscribe(fn, this._subscribers, options)
1076
+ }
1077
+
1078
+ Store.prototype.subscribeAction = function subscribeAction (fn, options) {
1079
+ var subs = typeof fn === 'function' ? { before: fn } : fn
1080
+ return genericSubscribe(subs, this._actionSubscribers, options)
1081
+ }
1082
+
1083
+ Store.prototype.watch = function watch$1 (getter, cb, options) {
1084
+ var this$1$1 = this
1085
+
1086
+ if ((process.env.NODE_ENV !== 'production')) {
1087
+ assert(typeof getter === 'function', 'store.watch only accepts a function.')
1088
+ }
1089
+ return vue.watch(function () { return getter(this$1$1.state, this$1$1.getters) }, cb, Object.assign({}, options))
1090
+ }
1091
+
1092
+ Store.prototype.replaceState = function replaceState (state) {
1093
+ var this$1$1 = this
1094
+
1095
+ this._withCommit(function () {
1096
+ this$1$1._state.data = state
1097
+ })
1098
+ }
1099
+
1100
+ Store.prototype.registerModule = function registerModule (path, rawModule, options) {
1101
+ if (options === void 0) options = {}
1102
+
1103
+ if (typeof path === 'string') { path = [path] }
1104
+
1105
+ if ((process.env.NODE_ENV !== 'production')) {
1106
+ assert(Array.isArray(path), 'module path must be a string or an Array.')
1107
+ assert(path.length > 0, 'cannot register the root module by using registerModule.')
1108
+ }
1109
+
1110
+ this._modules.register(path, rawModule)
1111
+ installModule(this, this.state, path, this._modules.get(path), options.preserveState)
1112
+ // reset store to update getters...
1113
+ resetStoreState(this, this.state)
1114
+ }
1115
+
1116
+ Store.prototype.unregisterModule = function unregisterModule (path) {
1117
+ var this$1$1 = this
1118
+
1119
+ if (typeof path === 'string') { path = [path] }
1120
+
1121
+ if ((process.env.NODE_ENV !== 'production')) {
1122
+ assert(Array.isArray(path), 'module path must be a string or an Array.')
1123
+ }
1124
+
1125
+ this._modules.unregister(path)
1126
+ this._withCommit(function () {
1127
+ var parentState = getNestedState(this$1$1.state, path.slice(0, -1))
1128
+ delete parentState[path[path.length - 1]]
1129
+ })
1130
+ resetStore(this)
1131
+ }
1132
+
1133
+ Store.prototype.hasModule = function hasModule (path) {
1134
+ if (typeof path === 'string') { path = [path] }
1135
+
1136
+ if ((process.env.NODE_ENV !== 'production')) {
1137
+ assert(Array.isArray(path), 'module path must be a string or an Array.')
1138
+ }
1139
+
1140
+ return this._modules.isRegistered(path)
1141
+ }
1142
+
1143
+ Store.prototype.hotUpdate = function hotUpdate (newOptions) {
1144
+ this._modules.update(newOptions)
1145
+ resetStore(this, true)
1146
+ }
1147
+
1148
+ Store.prototype._withCommit = function _withCommit (fn) {
1149
+ var committing = this._committing
1150
+ this._committing = true
1151
+ fn()
1152
+ this._committing = committing
1153
+ }
1154
+
1155
+ Object.defineProperties(Store.prototype, prototypeAccessors)
1156
+
1157
+ /**
1158
+ * Reduce the code which written in Vue.js for getting the state.
1159
+ * @param {String} [namespace] - Module's namespace
1160
+ * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
1161
+ * @param {Object}
1162
+ */
1163
+ var mapState = normalizeNamespace(function (namespace, states) {
1164
+ var res = {}
1165
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(states)) {
1166
+ console.error('[vuex] mapState: mapper parameter must be either an Array or an Object')
1167
+ }
1168
+ normalizeMap(states).forEach(function (ref) {
1169
+ var key = ref.key
1170
+ var val = ref.val
1171
+
1172
+ res[key] = function mappedState () {
1173
+ var state = this.$store.state
1174
+ var getters = this.$store.getters
1175
+ if (namespace) {
1176
+ var module = getModuleByNamespace(this.$store, 'mapState', namespace)
1177
+ if (!module) {
1178
+ return
1179
+ }
1180
+ state = module.context.state
1181
+ getters = module.context.getters
1182
+ }
1183
+ return typeof val === 'function'
1184
+ ? val.call(this, state, getters)
1185
+ : state[val]
1186
+ }
1187
+ // mark vuex getter for devtools
1188
+ res[key].vuex = true
1189
+ })
1190
+ return res
1191
+ })
1192
+
1193
+ /**
1194
+ * Reduce the code which written in Vue.js for committing the mutation
1195
+ * @param {String} [namespace] - Module's namespace
1196
+ * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
1197
+ * @return {Object}
1198
+ */
1199
+ var mapMutations = normalizeNamespace(function (namespace, mutations) {
1200
+ var res = {}
1201
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(mutations)) {
1202
+ console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object')
1203
+ }
1204
+ normalizeMap(mutations).forEach(function (ref) {
1205
+ var key = ref.key
1206
+ var val = ref.val
1207
+
1208
+ res[key] = function mappedMutation () {
1209
+ var args = []; var len = arguments.length
1210
+ while (len--) args[len] = arguments[len]
1211
+
1212
+ // Get the commit method from store
1213
+ var commit = this.$store.commit
1214
+ if (namespace) {
1215
+ var module = getModuleByNamespace(this.$store, 'mapMutations', namespace)
1216
+ if (!module) {
1217
+ return
1218
+ }
1219
+ commit = module.context.commit
1220
+ }
1221
+ return typeof val === 'function'
1222
+ ? val.apply(this, [commit].concat(args))
1223
+ : commit.apply(this.$store, [val].concat(args))
1224
+ }
1225
+ })
1226
+ return res
1227
+ })
1228
+
1229
+ /**
1230
+ * Reduce the code which written in Vue.js for getting the getters
1231
+ * @param {String} [namespace] - Module's namespace
1232
+ * @param {Object|Array} getters
1233
+ * @return {Object}
1234
+ */
1235
+ var mapGetters = normalizeNamespace(function (namespace, getters) {
1236
+ var res = {}
1237
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(getters)) {
1238
+ console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object')
1239
+ }
1240
+ normalizeMap(getters).forEach(function (ref) {
1241
+ var key = ref.key
1242
+ var val = ref.val
1243
+
1244
+ // The namespace has been mutated by normalizeNamespace
1245
+ val = namespace + val
1246
+ res[key] = function mappedGetter () {
1247
+ if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
1248
+ return
1249
+ }
1250
+ if ((process.env.NODE_ENV !== 'production') && !(val in this.$store.getters)) {
1251
+ console.error(('[vuex] unknown getter: ' + val))
1252
+ return
1253
+ }
1254
+ return this.$store.getters[val]
1255
+ }
1256
+ // mark vuex getter for devtools
1257
+ res[key].vuex = true
1258
+ })
1259
+ return res
1260
+ })
1261
+
1262
+ /**
1263
+ * Reduce the code which written in Vue.js for dispatch the action
1264
+ * @param {String} [namespace] - Module's namespace
1265
+ * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
1266
+ * @return {Object}
1267
+ */
1268
+ var mapActions = normalizeNamespace(function (namespace, actions) {
1269
+ var res = {}
1270
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(actions)) {
1271
+ console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object')
1272
+ }
1273
+ normalizeMap(actions).forEach(function (ref) {
1274
+ var key = ref.key
1275
+ var val = ref.val
1276
+
1277
+ res[key] = function mappedAction () {
1278
+ var args = []; var len = arguments.length
1279
+ while (len--) args[len] = arguments[len]
1280
+
1281
+ // get dispatch function from store
1282
+ var dispatch = this.$store.dispatch
1283
+ if (namespace) {
1284
+ var module = getModuleByNamespace(this.$store, 'mapActions', namespace)
1285
+ if (!module) {
1286
+ return
1287
+ }
1288
+ dispatch = module.context.dispatch
1289
+ }
1290
+ return typeof val === 'function'
1291
+ ? val.apply(this, [dispatch].concat(args))
1292
+ : dispatch.apply(this.$store, [val].concat(args))
1293
+ }
1294
+ })
1295
+ return res
1296
+ })
1297
+
1298
+ /**
1299
+ * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
1300
+ * @param {String} namespace
1301
+ * @return {Object}
1302
+ */
1303
+ var createNamespacedHelpers = function (namespace) {
1304
+ return ({
1305
+ mapState: mapState.bind(null, namespace),
1306
+ mapGetters: mapGetters.bind(null, namespace),
1307
+ mapMutations: mapMutations.bind(null, namespace),
1308
+ mapActions: mapActions.bind(null, namespace)
1309
+ })
1310
+ }
1311
+
1312
+ /**
1313
+ * Normalize the map
1314
+ * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
1315
+ * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
1316
+ * @param {Array|Object} map
1317
+ * @return {Object}
1318
+ */
1319
+ function normalizeMap (map) {
1320
+ if (!isValidMap(map)) {
1321
+ return []
1322
+ }
1323
+ return Array.isArray(map)
1324
+ ? map.map(function (key) { return ({ key: key, val: key }) })
1325
+ : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }) })
1326
+ }
1327
+
1328
+ /**
1329
+ * Validate whether given map is valid or not
1330
+ * @param {*} map
1331
+ * @return {Boolean}
1332
+ */
1333
+ function isValidMap (map) {
1334
+ return Array.isArray(map) || isObject(map)
1335
+ }
1336
+
1337
+ /**
1338
+ * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
1339
+ * @param {Function} fn
1340
+ * @return {Function}
1341
+ */
1342
+ function normalizeNamespace (fn) {
1343
+ return function (namespace, map) {
1344
+ if (typeof namespace !== 'string') {
1345
+ map = namespace
1346
+ namespace = ''
1347
+ } else if (namespace.charAt(namespace.length - 1) !== '/') {
1348
+ namespace += '/'
1349
+ }
1350
+ return fn(namespace, map)
1351
+ }
1352
+ }
1353
+
1354
+ /**
1355
+ * Search a special module from store by namespace. if module not exist, print error message.
1356
+ * @param {Object} store
1357
+ * @param {String} helper
1358
+ * @param {String} namespace
1359
+ * @return {Object}
1360
+ */
1361
+ function getModuleByNamespace (store, helper, namespace) {
1362
+ var module = store._modulesNamespaceMap[namespace]
1363
+ if ((process.env.NODE_ENV !== 'production') && !module) {
1364
+ console.error(('[vuex] module namespace not found in ' + helper + '(): ' + namespace))
1365
+ }
1366
+ return module
1367
+ }
1368
+
1369
+ // Credits: borrowed code from fcomb/redux-logger
1370
+
1371
+ function createLogger (ref) {
1372
+ if (ref === void 0) ref = {}
1373
+ var collapsed = ref.collapsed; if (collapsed === void 0) collapsed = true
1374
+ var filter = ref.filter; if (filter === void 0) filter = function (mutation, stateBefore, stateAfter) { return true }
1375
+ var transformer = ref.transformer; if (transformer === void 0) transformer = function (state) { return state }
1376
+ var mutationTransformer = ref.mutationTransformer; if (mutationTransformer === void 0) mutationTransformer = function (mut) { return mut }
1377
+ var actionFilter = ref.actionFilter; if (actionFilter === void 0) actionFilter = function (action, state) { return true }
1378
+ var actionTransformer = ref.actionTransformer; if (actionTransformer === void 0) actionTransformer = function (act) { return act }
1379
+ var logMutations = ref.logMutations; if (logMutations === void 0) logMutations = true
1380
+ var logActions = ref.logActions; if (logActions === void 0) logActions = true
1381
+ var logger = ref.logger; if (logger === void 0) logger = console
1382
+
1383
+ return function (store) {
1384
+ var prevState = deepCopy(store.state)
1385
+
1386
+ if (typeof logger === 'undefined') {
1387
+ return
1388
+ }
1389
+
1390
+ if (logMutations) {
1391
+ store.subscribe(function (mutation, state) {
1392
+ var nextState = deepCopy(state)
1393
+
1394
+ if (filter(mutation, prevState, nextState)) {
1395
+ var formattedTime = getFormattedTime()
1396
+ var formattedMutation = mutationTransformer(mutation)
1397
+ var message = 'mutation ' + (mutation.type) + formattedTime
1398
+
1399
+ startMessage(logger, message, collapsed)
1400
+ logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState))
1401
+ logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation)
1402
+ logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState))
1403
+ endMessage(logger)
1404
+ }
1405
+
1406
+ prevState = nextState
1407
+ })
1408
+ }
1409
+
1410
+ if (logActions) {
1411
+ store.subscribeAction(function (action, state) {
1412
+ if (actionFilter(action, state)) {
1413
+ var formattedTime = getFormattedTime()
1414
+ var formattedAction = actionTransformer(action)
1415
+ var message = 'action ' + (action.type) + formattedTime
1416
+
1417
+ startMessage(logger, message, collapsed)
1418
+ logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction)
1419
+ endMessage(logger)
1420
+ }
1421
+ })
1422
+ }
1423
+ }
1424
+ }
1425
+
1426
+ function startMessage (logger, message, collapsed) {
1427
+ var startMessage = collapsed
1428
+ ? logger.groupCollapsed
1429
+ : logger.group
1430
+
1431
+ // render
1432
+ try {
1433
+ startMessage.call(logger, message)
1434
+ } catch (e) {
1435
+ logger.log(message)
1436
+ }
1437
+ }
1438
+
1439
+ function endMessage (logger) {
1440
+ try {
1441
+ logger.groupEnd()
1442
+ } catch (e) {
1443
+ logger.log('—— log end ——')
1444
+ }
1445
+ }
1446
+
1447
+ function getFormattedTime () {
1448
+ var time = new Date()
1449
+ return (' @ ' + (pad(time.getHours(), 2)) + ':' + (pad(time.getMinutes(), 2)) + ':' + (pad(time.getSeconds(), 2)) + '.' + (pad(time.getMilliseconds(), 3)))
1450
+ }
1451
+
1452
+ function repeat (str, times) {
1453
+ return (new Array(times + 1)).join(str)
1454
+ }
1455
+
1456
+ function pad (num, maxLength) {
1457
+ return repeat('0', maxLength - num.toString().length) + num
1458
+ }
1459
+
1460
+ var index_cjs = {
1461
+ version: '4.0.2',
1462
+ Store: Store,
1463
+ storeKey: storeKey,
1464
+ createStore: createStore,
1465
+ useStore: useStore,
1466
+ mapState: mapState,
1467
+ mapMutations: mapMutations,
1468
+ mapGetters: mapGetters,
1469
+ mapActions: mapActions,
1470
+ createNamespacedHelpers: createNamespacedHelpers,
1471
+ createLogger: createLogger
1472
+ }
1473
+
1474
+ module.exports = index_cjs