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