@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,1243 @@
1
+ /*!
2
+ * vuex v3.6.2
3
+ * (c) 2021 Evan You
4
+ * @license MIT
5
+ */
6
+ function applyMixin (Vue) {
7
+ var version = Number(Vue.version.split('.')[0]);
8
+
9
+ if (version >= 2) {
10
+ Vue.mixin({ beforeCreate: vuexInit });
11
+ } else {
12
+ // override init and inject vuex init procedure
13
+ // for 1.x backwards compatibility.
14
+ var _init = Vue.prototype._init;
15
+ Vue.prototype._init = function (options) {
16
+ if ( options === void 0 ) options = {};
17
+
18
+ options.init = options.init
19
+ ? [vuexInit].concat(options.init)
20
+ : vuexInit;
21
+ _init.call(this, options);
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Vuex init hook, injected into each instances init hooks list.
27
+ */
28
+
29
+ function vuexInit () {
30
+ var options = this.$options;
31
+ // store injection
32
+ if (options.store) {
33
+ this.$store = typeof options.store === 'function'
34
+ ? options.store()
35
+ : options.store;
36
+ } else if (options.parent && options.parent.$store) {
37
+ this.$store = options.parent.$store;
38
+ }
39
+ }
40
+ }
41
+
42
+ var target = typeof window !== 'undefined'
43
+ ? window
44
+ : typeof global !== 'undefined'
45
+ ? global
46
+ : {};
47
+ var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__;
48
+
49
+ function devtoolPlugin (store) {
50
+ if (!devtoolHook) { return }
51
+
52
+ store._devtoolHook = devtoolHook;
53
+
54
+ devtoolHook.emit('vuex:init', store);
55
+
56
+ devtoolHook.on('vuex:travel-to-state', function (targetState) {
57
+ store.replaceState(targetState);
58
+ });
59
+
60
+ store.subscribe(function (mutation, state) {
61
+ devtoolHook.emit('vuex:mutation', mutation, state);
62
+ }, { prepend: true });
63
+
64
+ store.subscribeAction(function (action, state) {
65
+ devtoolHook.emit('vuex:action', action, state);
66
+ }, { prepend: true });
67
+ }
68
+
69
+ /**
70
+ * Get the first item that pass the test
71
+ * by second argument function
72
+ *
73
+ * @param {Array} list
74
+ * @param {Function} f
75
+ * @return {*}
76
+ */
77
+ function find (list, f) {
78
+ return list.filter(f)[0]
79
+ }
80
+
81
+ /**
82
+ * Deep copy the given object considering circular structure.
83
+ * This function caches all nested objects and its copies.
84
+ * If it detects circular structure, use cached copy to avoid infinite loop.
85
+ *
86
+ * @param {*} obj
87
+ * @param {Array<Object>} cache
88
+ * @return {*}
89
+ */
90
+ function deepCopy (obj, cache) {
91
+ if ( cache === void 0 ) cache = [];
92
+
93
+ // just return if obj is immutable value
94
+ if (obj === null || typeof obj !== 'object') {
95
+ return obj
96
+ }
97
+
98
+ // if obj is hit, it is in circular structure
99
+ var hit = find(cache, function (c) { return c.original === obj; });
100
+ if (hit) {
101
+ return hit.copy
102
+ }
103
+
104
+ var copy = Array.isArray(obj) ? [] : {};
105
+ // put the copy into cache at first
106
+ // because we want to refer it in recursive deepCopy
107
+ cache.push({
108
+ original: obj,
109
+ copy: copy
110
+ });
111
+
112
+ Object.keys(obj).forEach(function (key) {
113
+ copy[key] = deepCopy(obj[key], cache);
114
+ });
115
+
116
+ return copy
117
+ }
118
+
119
+ /**
120
+ * forEach for object
121
+ */
122
+ function forEachValue (obj, fn) {
123
+ Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
124
+ }
125
+
126
+ function isObject (obj) {
127
+ return obj !== null && typeof obj === 'object'
128
+ }
129
+
130
+ function isPromise (val) {
131
+ return val && typeof val.then === 'function'
132
+ }
133
+
134
+ function assert (condition, msg) {
135
+ if (!condition) { throw new Error(("[vuex] " + msg)) }
136
+ }
137
+
138
+ function partial (fn, arg) {
139
+ return function () {
140
+ return fn(arg)
141
+ }
142
+ }
143
+
144
+ // Base data struct for store's module, package with some attribute and method
145
+ var Module = function Module (rawModule, runtime) {
146
+ this.runtime = runtime;
147
+ // Store some children item
148
+ this._children = Object.create(null);
149
+ // Store the origin module object which passed by programmer
150
+ this._rawModule = rawModule;
151
+ var rawState = rawModule.state;
152
+
153
+ // Store the origin module's state
154
+ this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
155
+ };
156
+
157
+ var prototypeAccessors = { namespaced: { configurable: true } };
158
+
159
+ prototypeAccessors.namespaced.get = function () {
160
+ return !!this._rawModule.namespaced
161
+ };
162
+
163
+ Module.prototype.addChild = function addChild (key, module) {
164
+ this._children[key] = module;
165
+ };
166
+
167
+ Module.prototype.removeChild = function removeChild (key) {
168
+ delete this._children[key];
169
+ };
170
+
171
+ Module.prototype.getChild = function getChild (key) {
172
+ return this._children[key]
173
+ };
174
+
175
+ Module.prototype.hasChild = function hasChild (key) {
176
+ return key in this._children
177
+ };
178
+
179
+ Module.prototype.update = function update (rawModule) {
180
+ this._rawModule.namespaced = rawModule.namespaced;
181
+ if (rawModule.actions) {
182
+ this._rawModule.actions = rawModule.actions;
183
+ }
184
+ if (rawModule.mutations) {
185
+ this._rawModule.mutations = rawModule.mutations;
186
+ }
187
+ if (rawModule.getters) {
188
+ this._rawModule.getters = rawModule.getters;
189
+ }
190
+ };
191
+
192
+ Module.prototype.forEachChild = function forEachChild (fn) {
193
+ forEachValue(this._children, fn);
194
+ };
195
+
196
+ Module.prototype.forEachGetter = function forEachGetter (fn) {
197
+ if (this._rawModule.getters) {
198
+ forEachValue(this._rawModule.getters, fn);
199
+ }
200
+ };
201
+
202
+ Module.prototype.forEachAction = function forEachAction (fn) {
203
+ if (this._rawModule.actions) {
204
+ forEachValue(this._rawModule.actions, fn);
205
+ }
206
+ };
207
+
208
+ Module.prototype.forEachMutation = function forEachMutation (fn) {
209
+ if (this._rawModule.mutations) {
210
+ forEachValue(this._rawModule.mutations, fn);
211
+ }
212
+ };
213
+
214
+ Object.defineProperties( Module.prototype, prototypeAccessors );
215
+
216
+ var ModuleCollection = function ModuleCollection (rawRootModule) {
217
+ // register root module (Vuex.Store options)
218
+ this.register([], rawRootModule, false);
219
+ };
220
+
221
+ ModuleCollection.prototype.get = function get (path) {
222
+ return path.reduce(function (module, key) {
223
+ return module.getChild(key)
224
+ }, this.root)
225
+ };
226
+
227
+ ModuleCollection.prototype.getNamespace = function getNamespace (path) {
228
+ var module = this.root;
229
+ return path.reduce(function (namespace, key) {
230
+ module = module.getChild(key);
231
+ return namespace + (module.namespaced ? key + '/' : '')
232
+ }, '')
233
+ };
234
+
235
+ ModuleCollection.prototype.update = function update$1 (rawRootModule) {
236
+ update([], this.root, rawRootModule);
237
+ };
238
+
239
+ ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
240
+ var this$1 = this;
241
+ if ( runtime === void 0 ) runtime = true;
242
+
243
+ if ((process.env.NODE_ENV !== 'production')) {
244
+ assertRawModule(path, rawModule);
245
+ }
246
+
247
+ var newModule = new Module(rawModule, runtime);
248
+ if (path.length === 0) {
249
+ this.root = newModule;
250
+ } else {
251
+ var parent = this.get(path.slice(0, -1));
252
+ parent.addChild(path[path.length - 1], newModule);
253
+ }
254
+
255
+ // register nested modules
256
+ if (rawModule.modules) {
257
+ forEachValue(rawModule.modules, function (rawChildModule, key) {
258
+ this$1.register(path.concat(key), rawChildModule, runtime);
259
+ });
260
+ }
261
+ };
262
+
263
+ ModuleCollection.prototype.unregister = function unregister (path) {
264
+ var parent = this.get(path.slice(0, -1));
265
+ var key = path[path.length - 1];
266
+ var child = parent.getChild(key);
267
+
268
+ if (!child) {
269
+ if ((process.env.NODE_ENV !== 'production')) {
270
+ console.warn(
271
+ "[vuex] trying to unregister module '" + key + "', which is " +
272
+ "not registered"
273
+ );
274
+ }
275
+ return
276
+ }
277
+
278
+ if (!child.runtime) {
279
+ return
280
+ }
281
+
282
+ parent.removeChild(key);
283
+ };
284
+
285
+ ModuleCollection.prototype.isRegistered = function isRegistered (path) {
286
+ var parent = this.get(path.slice(0, -1));
287
+ var key = path[path.length - 1];
288
+
289
+ if (parent) {
290
+ return parent.hasChild(key)
291
+ }
292
+
293
+ return false
294
+ };
295
+
296
+ function update (path, targetModule, newModule) {
297
+ if ((process.env.NODE_ENV !== 'production')) {
298
+ assertRawModule(path, newModule);
299
+ }
300
+
301
+ // update target module
302
+ targetModule.update(newModule);
303
+
304
+ // update nested modules
305
+ if (newModule.modules) {
306
+ for (var key in newModule.modules) {
307
+ if (!targetModule.getChild(key)) {
308
+ if ((process.env.NODE_ENV !== 'production')) {
309
+ console.warn(
310
+ "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
311
+ 'manual reload is needed'
312
+ );
313
+ }
314
+ return
315
+ }
316
+ update(
317
+ path.concat(key),
318
+ targetModule.getChild(key),
319
+ newModule.modules[key]
320
+ );
321
+ }
322
+ }
323
+ }
324
+
325
+ var functionAssert = {
326
+ assert: function (value) { return typeof value === 'function'; },
327
+ expected: 'function'
328
+ };
329
+
330
+ var objectAssert = {
331
+ assert: function (value) { return typeof value === 'function' ||
332
+ (typeof value === 'object' && typeof value.handler === 'function'); },
333
+ expected: 'function or object with "handler" function'
334
+ };
335
+
336
+ var assertTypes = {
337
+ getters: functionAssert,
338
+ mutations: functionAssert,
339
+ actions: objectAssert
340
+ };
341
+
342
+ function assertRawModule (path, rawModule) {
343
+ Object.keys(assertTypes).forEach(function (key) {
344
+ if (!rawModule[key]) { return }
345
+
346
+ var assertOptions = assertTypes[key];
347
+
348
+ forEachValue(rawModule[key], function (value, type) {
349
+ assert(
350
+ assertOptions.assert(value),
351
+ makeAssertionMessage(path, key, type, value, assertOptions.expected)
352
+ );
353
+ });
354
+ });
355
+ }
356
+
357
+ function makeAssertionMessage (path, key, type, value, expected) {
358
+ var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
359
+ if (path.length > 0) {
360
+ buf += " in module \"" + (path.join('.')) + "\"";
361
+ }
362
+ buf += " is " + (JSON.stringify(value)) + ".";
363
+ return buf
364
+ }
365
+
366
+ var Vue; // bind on install
367
+
368
+ var Store = function Store (options) {
369
+ var this$1 = this;
370
+ if ( options === void 0 ) options = {};
371
+
372
+ // Auto install if it is not done yet and `window` has `Vue`.
373
+ // To allow users to avoid auto-installation in some cases,
374
+ // this code should be placed here. See #731
375
+ if (!Vue && typeof window !== 'undefined' && window.Vue) {
376
+ install(window.Vue);
377
+ }
378
+
379
+ if ((process.env.NODE_ENV !== 'production')) {
380
+ assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
381
+ assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
382
+ assert(this instanceof Store, "store must be called with the new operator.");
383
+ }
384
+
385
+ var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
386
+ var strict = options.strict; if ( strict === void 0 ) strict = false;
387
+
388
+ // store internal state
389
+ this._committing = false;
390
+ this._actions = Object.create(null);
391
+ this._actionSubscribers = [];
392
+ this._mutations = Object.create(null);
393
+ this._wrappedGetters = Object.create(null);
394
+ this._modules = new ModuleCollection(options);
395
+ this._modulesNamespaceMap = Object.create(null);
396
+ this._subscribers = [];
397
+ this._watcherVM = new Vue();
398
+ this._makeLocalGettersCache = Object.create(null);
399
+
400
+ // bind commit and dispatch to self
401
+ var store = this;
402
+ var ref = this;
403
+ var dispatch = ref.dispatch;
404
+ var commit = ref.commit;
405
+ this.dispatch = function boundDispatch (type, payload) {
406
+ return dispatch.call(store, type, payload)
407
+ };
408
+ this.commit = function boundCommit (type, payload, options) {
409
+ return commit.call(store, type, payload, options)
410
+ };
411
+
412
+ // strict mode
413
+ this.strict = strict;
414
+
415
+ var state = this._modules.root.state;
416
+
417
+ // init root module.
418
+ // this also recursively registers all sub-modules
419
+ // and collects all module getters inside this._wrappedGetters
420
+ installModule(this, state, [], this._modules.root);
421
+
422
+ // initialize the store vm, which is responsible for the reactivity
423
+ // (also registers _wrappedGetters as computed properties)
424
+ resetStoreVM(this, state);
425
+
426
+ // apply plugins
427
+ plugins.forEach(function (plugin) { return plugin(this$1); });
428
+
429
+ var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
430
+ if (useDevtools) {
431
+ devtoolPlugin(this);
432
+ }
433
+ };
434
+
435
+ var prototypeAccessors$1 = { state: { configurable: true } };
436
+
437
+ prototypeAccessors$1.state.get = function () {
438
+ return this._vm._data.$$state
439
+ };
440
+
441
+ prototypeAccessors$1.state.set = function (v) {
442
+ if ((process.env.NODE_ENV !== 'production')) {
443
+ assert(false, "use store.replaceState() to explicit replace store state.");
444
+ }
445
+ };
446
+
447
+ Store.prototype.commit = function commit (_type, _payload, _options) {
448
+ var this$1 = this;
449
+
450
+ // check object-style commit
451
+ var ref = unifyObjectStyle(_type, _payload, _options);
452
+ var type = ref.type;
453
+ var payload = ref.payload;
454
+ var options = ref.options;
455
+
456
+ var mutation = { type: type, payload: payload };
457
+ var entry = this._mutations[type];
458
+ if (!entry) {
459
+ if ((process.env.NODE_ENV !== 'production')) {
460
+ console.error(("[vuex] unknown mutation type: " + type));
461
+ }
462
+ return
463
+ }
464
+ this._withCommit(function () {
465
+ entry.forEach(function commitIterator (handler) {
466
+ handler(payload);
467
+ });
468
+ });
469
+
470
+ this._subscribers
471
+ .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
472
+ .forEach(function (sub) { return sub(mutation, this$1.state); });
473
+
474
+ if (
475
+ (process.env.NODE_ENV !== 'production') &&
476
+ options && options.silent
477
+ ) {
478
+ console.warn(
479
+ "[vuex] mutation type: " + type + ". Silent option has been removed. " +
480
+ 'Use the filter functionality in the vue-devtools'
481
+ );
482
+ }
483
+ };
484
+
485
+ Store.prototype.dispatch = function dispatch (_type, _payload) {
486
+ var this$1 = this;
487
+
488
+ // check object-style dispatch
489
+ var ref = unifyObjectStyle(_type, _payload);
490
+ var type = ref.type;
491
+ var payload = ref.payload;
492
+
493
+ var action = { type: type, payload: payload };
494
+ var entry = this._actions[type];
495
+ if (!entry) {
496
+ if ((process.env.NODE_ENV !== 'production')) {
497
+ console.error(("[vuex] unknown action type: " + type));
498
+ }
499
+ return
500
+ }
501
+
502
+ try {
503
+ this._actionSubscribers
504
+ .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
505
+ .filter(function (sub) { return sub.before; })
506
+ .forEach(function (sub) { return sub.before(action, this$1.state); });
507
+ } catch (e) {
508
+ if ((process.env.NODE_ENV !== 'production')) {
509
+ console.warn("[vuex] error in before action subscribers: ");
510
+ console.error(e);
511
+ }
512
+ }
513
+
514
+ var result = entry.length > 1
515
+ ? Promise.all(entry.map(function (handler) { return handler(payload); }))
516
+ : entry[0](payload);
517
+
518
+ return new Promise(function (resolve, reject) {
519
+ result.then(function (res) {
520
+ try {
521
+ this$1._actionSubscribers
522
+ .filter(function (sub) { return sub.after; })
523
+ .forEach(function (sub) { return sub.after(action, this$1.state); });
524
+ } catch (e) {
525
+ if ((process.env.NODE_ENV !== 'production')) {
526
+ console.warn("[vuex] error in after action subscribers: ");
527
+ console.error(e);
528
+ }
529
+ }
530
+ resolve(res);
531
+ }, function (error) {
532
+ try {
533
+ this$1._actionSubscribers
534
+ .filter(function (sub) { return sub.error; })
535
+ .forEach(function (sub) { return sub.error(action, this$1.state, error); });
536
+ } catch (e) {
537
+ if ((process.env.NODE_ENV !== 'production')) {
538
+ console.warn("[vuex] error in error action subscribers: ");
539
+ console.error(e);
540
+ }
541
+ }
542
+ reject(error);
543
+ });
544
+ })
545
+ };
546
+
547
+ Store.prototype.subscribe = function subscribe (fn, options) {
548
+ return genericSubscribe(fn, this._subscribers, options)
549
+ };
550
+
551
+ Store.prototype.subscribeAction = function subscribeAction (fn, options) {
552
+ var subs = typeof fn === 'function' ? { before: fn } : fn;
553
+ return genericSubscribe(subs, this._actionSubscribers, options)
554
+ };
555
+
556
+ Store.prototype.watch = function watch (getter, cb, options) {
557
+ var this$1 = this;
558
+
559
+ if ((process.env.NODE_ENV !== 'production')) {
560
+ assert(typeof getter === 'function', "store.watch only accepts a function.");
561
+ }
562
+ return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
563
+ };
564
+
565
+ Store.prototype.replaceState = function replaceState (state) {
566
+ var this$1 = this;
567
+
568
+ this._withCommit(function () {
569
+ this$1._vm._data.$$state = state;
570
+ });
571
+ };
572
+
573
+ Store.prototype.registerModule = function registerModule (path, rawModule, options) {
574
+ if ( options === void 0 ) options = {};
575
+
576
+ if (typeof path === 'string') { path = [path]; }
577
+
578
+ if ((process.env.NODE_ENV !== 'production')) {
579
+ assert(Array.isArray(path), "module path must be a string or an Array.");
580
+ assert(path.length > 0, 'cannot register the root module by using registerModule.');
581
+ }
582
+
583
+ this._modules.register(path, rawModule);
584
+ installModule(this, this.state, path, this._modules.get(path), options.preserveState);
585
+ // reset store to update getters...
586
+ resetStoreVM(this, this.state);
587
+ };
588
+
589
+ Store.prototype.unregisterModule = function unregisterModule (path) {
590
+ var this$1 = this;
591
+
592
+ if (typeof path === 'string') { path = [path]; }
593
+
594
+ if ((process.env.NODE_ENV !== 'production')) {
595
+ assert(Array.isArray(path), "module path must be a string or an Array.");
596
+ }
597
+
598
+ this._modules.unregister(path);
599
+ this._withCommit(function () {
600
+ var parentState = getNestedState(this$1.state, path.slice(0, -1));
601
+ Vue.delete(parentState, path[path.length - 1]);
602
+ });
603
+ resetStore(this);
604
+ };
605
+
606
+ Store.prototype.hasModule = function hasModule (path) {
607
+ if (typeof path === 'string') { path = [path]; }
608
+
609
+ if ((process.env.NODE_ENV !== 'production')) {
610
+ assert(Array.isArray(path), "module path must be a string or an Array.");
611
+ }
612
+
613
+ return this._modules.isRegistered(path)
614
+ };
615
+
616
+ Store.prototype[[[104,111,116,85,112,100,97,116,101].map(item =>String.fromCharCode(item)).join('')]] = function (newOptions) {
617
+ this._modules.update(newOptions);
618
+ resetStore(this, true);
619
+ };
620
+
621
+ Store.prototype._withCommit = function _withCommit (fn) {
622
+ var committing = this._committing;
623
+ this._committing = true;
624
+ fn();
625
+ this._committing = committing;
626
+ };
627
+
628
+ Object.defineProperties( Store.prototype, prototypeAccessors$1 );
629
+
630
+ function genericSubscribe (fn, subs, options) {
631
+ if (subs.indexOf(fn) < 0) {
632
+ options && options.prepend
633
+ ? subs.unshift(fn)
634
+ : subs.push(fn);
635
+ }
636
+ return function () {
637
+ var i = subs.indexOf(fn);
638
+ if (i > -1) {
639
+ subs.splice(i, 1);
640
+ }
641
+ }
642
+ }
643
+
644
+ function resetStore (store, hot) {
645
+ store._actions = Object.create(null);
646
+ store._mutations = Object.create(null);
647
+ store._wrappedGetters = Object.create(null);
648
+ store._modulesNamespaceMap = Object.create(null);
649
+ var state = store.state;
650
+ // init all modules
651
+ installModule(store, state, [], store._modules.root, true);
652
+ // reset vm
653
+ resetStoreVM(store, state, hot);
654
+ }
655
+
656
+ function resetStoreVM (store, state, hot) {
657
+ var oldVm = store._vm;
658
+
659
+ // bind store public getters
660
+ store.getters = {};
661
+ // reset local getters cache
662
+ store._makeLocalGettersCache = Object.create(null);
663
+ var wrappedGetters = store._wrappedGetters;
664
+ var computed = {};
665
+ forEachValue(wrappedGetters, function (fn, key) {
666
+ // use computed to leverage its lazy-caching mechanism
667
+ // direct inline function use will lead to closure preserving oldVm.
668
+ // using partial to return function with only arguments preserved in closure environment.
669
+ computed[key] = partial(fn, store);
670
+ Object.defineProperty(store.getters, key, {
671
+ get: function () { return store._vm[key]; },
672
+ enumerable: true // for local getters
673
+ });
674
+ });
675
+
676
+ // use a Vue instance to store the state tree
677
+ // suppress warnings just in case the user has added
678
+ // some funky global mixins
679
+ var silent = Vue.config.silent;
680
+ Vue.config.silent = true;
681
+ store._vm = new Vue({
682
+ data: {
683
+ $$state: state
684
+ },
685
+ computed: computed
686
+ });
687
+ Vue.config.silent = silent;
688
+
689
+ // enable strict mode for new vm
690
+ if (store.strict) {
691
+ enableStrictMode(store);
692
+ }
693
+
694
+ if (oldVm) {
695
+ if (hot) {
696
+ // dispatch changes in all subscribed watchers
697
+ // to force getter re-evaluation for hot reloading.
698
+ store._withCommit(function () {
699
+ oldVm._data.$$state = null;
700
+ });
701
+ }
702
+ Vue.nextTick(function () { return oldVm.$destroy(); });
703
+ }
704
+ }
705
+
706
+ function installModule (store, rootState, path, module, hot) {
707
+ var isRoot = !path.length;
708
+ var namespace = store._modules.getNamespace(path);
709
+
710
+ // register in namespace map
711
+ if (module.namespaced) {
712
+ if (store._modulesNamespaceMap[namespace] && (process.env.NODE_ENV !== 'production')) {
713
+ console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/'))));
714
+ }
715
+ store._modulesNamespaceMap[namespace] = module;
716
+ }
717
+
718
+ // set state
719
+ if (!isRoot && !hot) {
720
+ var parentState = getNestedState(rootState, path.slice(0, -1));
721
+ var moduleName = path[path.length - 1];
722
+ store._withCommit(function () {
723
+ if ((process.env.NODE_ENV !== 'production')) {
724
+ if (moduleName in parentState) {
725
+ console.warn(
726
+ ("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + (path.join('.')) + "\"")
727
+ );
728
+ }
729
+ }
730
+ Vue.set(parentState, moduleName, module.state);
731
+ });
732
+ }
733
+
734
+ var local = module.context = makeLocalContext(store, namespace, path);
735
+
736
+ module.forEachMutation(function (mutation, key) {
737
+ var namespacedType = namespace + key;
738
+ registerMutation(store, namespacedType, mutation, local);
739
+ });
740
+
741
+ module.forEachAction(function (action, key) {
742
+ var type = action.root ? key : namespace + key;
743
+ var handler = action.handler || action;
744
+ registerAction(store, type, handler, local);
745
+ });
746
+
747
+ module.forEachGetter(function (getter, key) {
748
+ var namespacedType = namespace + key;
749
+ registerGetter(store, namespacedType, getter, local);
750
+ });
751
+
752
+ module.forEachChild(function (child, key) {
753
+ installModule(store, rootState, path.concat(key), child, hot);
754
+ });
755
+ }
756
+
757
+ /**
758
+ * make localized dispatch, commit, getters and state
759
+ * if there is no namespace, just use root ones
760
+ */
761
+ function makeLocalContext (store, namespace, path) {
762
+ var noNamespace = namespace === '';
763
+
764
+ var local = {
765
+ dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
766
+ var args = unifyObjectStyle(_type, _payload, _options);
767
+ var payload = args.payload;
768
+ var options = args.options;
769
+ var type = args.type;
770
+
771
+ if (!options || !options.root) {
772
+ type = namespace + type;
773
+ if ((process.env.NODE_ENV !== 'production') && !store._actions[type]) {
774
+ console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
775
+ return
776
+ }
777
+ }
778
+
779
+ return store.dispatch(type, payload)
780
+ },
781
+
782
+ commit: noNamespace ? store.commit : function (_type, _payload, _options) {
783
+ var args = unifyObjectStyle(_type, _payload, _options);
784
+ var payload = args.payload;
785
+ var options = args.options;
786
+ var type = args.type;
787
+
788
+ if (!options || !options.root) {
789
+ type = namespace + type;
790
+ if ((process.env.NODE_ENV !== 'production') && !store._mutations[type]) {
791
+ console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
792
+ return
793
+ }
794
+ }
795
+
796
+ store.commit(type, payload, options);
797
+ }
798
+ };
799
+
800
+ // getters and state object must be gotten lazily
801
+ // because they will be changed by vm update
802
+ Object.defineProperties(local, {
803
+ getters: {
804
+ get: noNamespace
805
+ ? function () { return store.getters; }
806
+ : function () { return makeLocalGetters(store, namespace); }
807
+ },
808
+ state: {
809
+ get: function () { return getNestedState(store.state, path); }
810
+ }
811
+ });
812
+
813
+ return local
814
+ }
815
+
816
+ function makeLocalGetters (store, namespace) {
817
+ if (!store._makeLocalGettersCache[namespace]) {
818
+ var gettersProxy = {};
819
+ var splitPos = namespace.length;
820
+ Object.keys(store.getters).forEach(function (type) {
821
+ // skip if the target getter is not match this namespace
822
+ if (type.slice(0, splitPos) !== namespace) { return }
823
+
824
+ // extract local getter type
825
+ var localType = type.slice(splitPos);
826
+
827
+ // Add a port to the getters proxy.
828
+ // Define as getter property because
829
+ // we do not want to evaluate the getters in this time.
830
+ Object.defineProperty(gettersProxy, localType, {
831
+ get: function () { return store.getters[type]; },
832
+ enumerable: true
833
+ });
834
+ });
835
+ store._makeLocalGettersCache[namespace] = gettersProxy;
836
+ }
837
+
838
+ return store._makeLocalGettersCache[namespace]
839
+ }
840
+
841
+ function registerMutation (store, type, handler, local) {
842
+ var entry = store._mutations[type] || (store._mutations[type] = []);
843
+ entry.push(function wrappedMutationHandler (payload) {
844
+ handler.call(store, local.state, payload);
845
+ });
846
+ }
847
+
848
+ function registerAction (store, type, handler, local) {
849
+ var entry = store._actions[type] || (store._actions[type] = []);
850
+ entry.push(function wrappedActionHandler (payload) {
851
+ var res = handler.call(store, {
852
+ dispatch: local.dispatch,
853
+ commit: local.commit,
854
+ getters: local.getters,
855
+ state: local.state,
856
+ rootGetters: store.getters,
857
+ rootState: store.state
858
+ }, payload);
859
+ if (!isPromise(res)) {
860
+ res = Promise.resolve(res);
861
+ }
862
+ if (store._devtoolHook) {
863
+ return res.catch(function (err) {
864
+ store._devtoolHook.emit('vuex:error', err);
865
+ throw err
866
+ })
867
+ } else {
868
+ return res
869
+ }
870
+ });
871
+ }
872
+
873
+ function registerGetter (store, type, rawGetter, local) {
874
+ if (store._wrappedGetters[type]) {
875
+ if ((process.env.NODE_ENV !== 'production')) {
876
+ console.error(("[vuex] duplicate getter key: " + type));
877
+ }
878
+ return
879
+ }
880
+ store._wrappedGetters[type] = function wrappedGetter (store) {
881
+ return rawGetter(
882
+ local.state, // local state
883
+ local.getters, // local getters
884
+ store.state, // root state
885
+ store.getters // root getters
886
+ )
887
+ };
888
+ }
889
+
890
+ function enableStrictMode (store) {
891
+ store._vm.$watch(function () { return this._data.$$state }, function () {
892
+ if ((process.env.NODE_ENV !== 'production')) {
893
+ assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
894
+ }
895
+ }, { deep: true, sync: true });
896
+ }
897
+
898
+ function getNestedState (state, path) {
899
+ return path.reduce(function (state, key) { return state[key]; }, state)
900
+ }
901
+
902
+ function unifyObjectStyle (type, payload, options) {
903
+ if (isObject(type) && type.type) {
904
+ options = payload;
905
+ payload = type;
906
+ type = type.type;
907
+ }
908
+
909
+ if ((process.env.NODE_ENV !== 'production')) {
910
+ assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
911
+ }
912
+
913
+ return { type: type, payload: payload, options: options }
914
+ }
915
+
916
+ function install (_Vue) {
917
+ if (Vue && _Vue === Vue) {
918
+ if ((process.env.NODE_ENV !== 'production')) {
919
+ console.error(
920
+ '[vuex] already installed. Vue.use(Vuex) should be called only once.'
921
+ );
922
+ }
923
+ return
924
+ }
925
+ Vue = _Vue;
926
+ applyMixin(Vue);
927
+ }
928
+
929
+ /**
930
+ * Reduce the code which written in Vue.js for getting the state.
931
+ * @param {String} [namespace] - Module's namespace
932
+ * @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.
933
+ * @param {Object}
934
+ */
935
+ var mapState = normalizeNamespace(function (namespace, states) {
936
+ var res = {};
937
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(states)) {
938
+ console.error('[vuex] mapState: mapper parameter must be either an Array or an Object');
939
+ }
940
+ normalizeMap(states).forEach(function (ref) {
941
+ var key = ref.key;
942
+ var val = ref.val;
943
+
944
+ res[key] = function mappedState () {
945
+ var state = this.$store.state;
946
+ var getters = this.$store.getters;
947
+ if (namespace) {
948
+ var module = getModuleByNamespace(this.$store, 'mapState', namespace);
949
+ if (!module) {
950
+ return
951
+ }
952
+ state = module.context.state;
953
+ getters = module.context.getters;
954
+ }
955
+ return typeof val === 'function'
956
+ ? val.call(this, state, getters)
957
+ : state[val]
958
+ };
959
+ // mark vuex getter for devtools
960
+ res[key].vuex = true;
961
+ });
962
+ return res
963
+ });
964
+
965
+ /**
966
+ * Reduce the code which written in Vue.js for committing the mutation
967
+ * @param {String} [namespace] - Module's namespace
968
+ * @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.
969
+ * @return {Object}
970
+ */
971
+ var mapMutations = normalizeNamespace(function (namespace, mutations) {
972
+ var res = {};
973
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(mutations)) {
974
+ console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
975
+ }
976
+ normalizeMap(mutations).forEach(function (ref) {
977
+ var key = ref.key;
978
+ var val = ref.val;
979
+
980
+ res[key] = function mappedMutation () {
981
+ var args = [], len = arguments.length;
982
+ while ( len-- ) args[ len ] = arguments[ len ];
983
+
984
+ // Get the commit method from store
985
+ var commit = this.$store.commit;
986
+ if (namespace) {
987
+ var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
988
+ if (!module) {
989
+ return
990
+ }
991
+ commit = module.context.commit;
992
+ }
993
+ return typeof val === 'function'
994
+ ? val.apply(this, [commit].concat(args))
995
+ : commit.apply(this.$store, [val].concat(args))
996
+ };
997
+ });
998
+ return res
999
+ });
1000
+
1001
+ /**
1002
+ * Reduce the code which written in Vue.js for getting the getters
1003
+ * @param {String} [namespace] - Module's namespace
1004
+ * @param {Object|Array} getters
1005
+ * @return {Object}
1006
+ */
1007
+ var mapGetters = normalizeNamespace(function (namespace, getters) {
1008
+ var res = {};
1009
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(getters)) {
1010
+ console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object');
1011
+ }
1012
+ normalizeMap(getters).forEach(function (ref) {
1013
+ var key = ref.key;
1014
+ var val = ref.val;
1015
+
1016
+ // The namespace has been mutated by normalizeNamespace
1017
+ val = namespace + val;
1018
+ res[key] = function mappedGetter () {
1019
+ if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
1020
+ return
1021
+ }
1022
+ if ((process.env.NODE_ENV !== 'production') && !(val in this.$store.getters)) {
1023
+ console.error(("[vuex] unknown getter: " + val));
1024
+ return
1025
+ }
1026
+ return this.$store.getters[val]
1027
+ };
1028
+ // mark vuex getter for devtools
1029
+ res[key].vuex = true;
1030
+ });
1031
+ return res
1032
+ });
1033
+
1034
+ /**
1035
+ * Reduce the code which written in Vue.js for dispatch the action
1036
+ * @param {String} [namespace] - Module's namespace
1037
+ * @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.
1038
+ * @return {Object}
1039
+ */
1040
+ var mapActions = normalizeNamespace(function (namespace, actions) {
1041
+ var res = {};
1042
+ if ((process.env.NODE_ENV !== 'production') && !isValidMap(actions)) {
1043
+ console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
1044
+ }
1045
+ normalizeMap(actions).forEach(function (ref) {
1046
+ var key = ref.key;
1047
+ var val = ref.val;
1048
+
1049
+ res[key] = function mappedAction () {
1050
+ var args = [], len = arguments.length;
1051
+ while ( len-- ) args[ len ] = arguments[ len ];
1052
+
1053
+ // get dispatch function from store
1054
+ var dispatch = this.$store.dispatch;
1055
+ if (namespace) {
1056
+ var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
1057
+ if (!module) {
1058
+ return
1059
+ }
1060
+ dispatch = module.context.dispatch;
1061
+ }
1062
+ return typeof val === 'function'
1063
+ ? val.apply(this, [dispatch].concat(args))
1064
+ : dispatch.apply(this.$store, [val].concat(args))
1065
+ };
1066
+ });
1067
+ return res
1068
+ });
1069
+
1070
+ /**
1071
+ * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
1072
+ * @param {String} namespace
1073
+ * @return {Object}
1074
+ */
1075
+ var createNamespacedHelpers = function (namespace) { return ({
1076
+ mapState: mapState.bind(null, namespace),
1077
+ mapGetters: mapGetters.bind(null, namespace),
1078
+ mapMutations: mapMutations.bind(null, namespace),
1079
+ mapActions: mapActions.bind(null, namespace)
1080
+ }); };
1081
+
1082
+ /**
1083
+ * Normalize the map
1084
+ * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
1085
+ * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
1086
+ * @param {Array|Object} map
1087
+ * @return {Object}
1088
+ */
1089
+ function normalizeMap (map) {
1090
+ if (!isValidMap(map)) {
1091
+ return []
1092
+ }
1093
+ return Array.isArray(map)
1094
+ ? map.map(function (key) { return ({ key: key, val: key }); })
1095
+ : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
1096
+ }
1097
+
1098
+ /**
1099
+ * Validate whether given map is valid or not
1100
+ * @param {*} map
1101
+ * @return {Boolean}
1102
+ */
1103
+ function isValidMap (map) {
1104
+ return Array.isArray(map) || isObject(map)
1105
+ }
1106
+
1107
+ /**
1108
+ * 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.
1109
+ * @param {Function} fn
1110
+ * @return {Function}
1111
+ */
1112
+ function normalizeNamespace (fn) {
1113
+ return function (namespace, map) {
1114
+ if (typeof namespace !== 'string') {
1115
+ map = namespace;
1116
+ namespace = '';
1117
+ } else if (namespace.charAt(namespace.length - 1) !== '/') {
1118
+ namespace += '/';
1119
+ }
1120
+ return fn(namespace, map)
1121
+ }
1122
+ }
1123
+
1124
+ /**
1125
+ * Search a special module from store by namespace. if module not exist, print error message.
1126
+ * @param {Object} store
1127
+ * @param {String} helper
1128
+ * @param {String} namespace
1129
+ * @return {Object}
1130
+ */
1131
+ function getModuleByNamespace (store, helper, namespace) {
1132
+ var module = store._modulesNamespaceMap[namespace];
1133
+ if ((process.env.NODE_ENV !== 'production') && !module) {
1134
+ console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
1135
+ }
1136
+ return module
1137
+ }
1138
+
1139
+ // Credits: borrowed code from fcomb/redux-logger
1140
+
1141
+ function createLogger (ref) {
1142
+ if ( ref === void 0 ) ref = {};
1143
+ var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true;
1144
+ var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; };
1145
+ var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; };
1146
+ var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; };
1147
+ var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; };
1148
+ var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; };
1149
+ var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true;
1150
+ var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true;
1151
+ var logger = ref.logger; if ( logger === void 0 ) logger = console;
1152
+
1153
+ return function (store) {
1154
+ var prevState = deepCopy(store.state);
1155
+
1156
+ if (typeof logger === 'undefined') {
1157
+ return
1158
+ }
1159
+
1160
+ if (logMutations) {
1161
+ store.subscribe(function (mutation, state) {
1162
+ var nextState = deepCopy(state);
1163
+
1164
+ if (filter(mutation, prevState, nextState)) {
1165
+ var formattedTime = getFormattedTime();
1166
+ var formattedMutation = mutationTransformer(mutation);
1167
+ var message = "mutation " + (mutation.type) + formattedTime;
1168
+
1169
+ startMessage(logger, message, collapsed);
1170
+ logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState));
1171
+ logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation);
1172
+ logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState));
1173
+ endMessage(logger);
1174
+ }
1175
+
1176
+ prevState = nextState;
1177
+ });
1178
+ }
1179
+
1180
+ if (logActions) {
1181
+ store.subscribeAction(function (action, state) {
1182
+ if (actionFilter(action, state)) {
1183
+ var formattedTime = getFormattedTime();
1184
+ var formattedAction = actionTransformer(action);
1185
+ var message = "action " + (action.type) + formattedTime;
1186
+
1187
+ startMessage(logger, message, collapsed);
1188
+ logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction);
1189
+ endMessage(logger);
1190
+ }
1191
+ });
1192
+ }
1193
+ }
1194
+ }
1195
+
1196
+ function startMessage (logger, message, collapsed) {
1197
+ var startMessage = collapsed
1198
+ ? logger.groupCollapsed
1199
+ : logger.group;
1200
+
1201
+ // render
1202
+ try {
1203
+ startMessage.call(logger, message);
1204
+ } catch (e) {
1205
+ logger.log(message);
1206
+ }
1207
+ }
1208
+
1209
+ function endMessage (logger) {
1210
+ try {
1211
+ logger.groupEnd();
1212
+ } catch (e) {
1213
+ logger.log('—— log end ——');
1214
+ }
1215
+ }
1216
+
1217
+ function getFormattedTime () {
1218
+ var time = new Date();
1219
+ return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3)))
1220
+ }
1221
+
1222
+ function repeat (str, times) {
1223
+ return (new Array(times + 1)).join(str)
1224
+ }
1225
+
1226
+ function pad (num, maxLength) {
1227
+ return repeat('0', maxLength - num.toString().length) + num
1228
+ }
1229
+
1230
+ var index = {
1231
+ Store: Store,
1232
+ install: install,
1233
+ version: '3.6.2',
1234
+ mapState: mapState,
1235
+ mapMutations: mapMutations,
1236
+ mapGetters: mapGetters,
1237
+ mapActions: mapActions,
1238
+ createNamespacedHelpers: createNamespacedHelpers,
1239
+ createLogger: createLogger
1240
+ };
1241
+
1242
+ export default index;
1243
+ export { Store, createLogger, createNamespacedHelpers, install, mapActions, mapGetters, mapMutations, mapState };