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