@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,6 @@
1
+ /*!
2
+ * vuex v4.0.2
3
+ * (c) 2021 Evan You
4
+ * @license MIT
5
+ */
6
+ var Vuex = (function (t) { 'use strict'; var e = 'store'; function n () { return typeof navigator !== 'undefined' ? window : typeof global !== 'undefined' ? global : {} } function o (t, e) { var o = n().__VUE_DEVTOOLS_GLOBAL_HOOK__; if (o)o.emit('devtools-plugin:setup', t, e); else { var r = n(); (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({ pluginDescriptor: t, setupFn: e }) } } function r (t, e) { if (void 0 === e && (e = []), t === null || typeof t !== 'object') return t; var n; var o = (n = function (e) { return e.original === t }, e.filter(n)[0]); if (o) return o.copy; var i = Array.isArray(t) ? [] : {}; return e.push({ original: t, copy: i }), Object.keys(t).forEach(function (n) { i[n] = r(t[n], e) }), i } function i (t, e) { Object.keys(t).forEach(function (n) { return e(t[n], n) }) } function a (t) { return t !== null && typeof t === 'object' } function c (t, e, n) { return e.indexOf(t) < 0 && (n && n.prepend ? e.unshift(t) : e.push(t)), function () { var n = e.indexOf(t); n > -1 && e.splice(n, 1) } } function s (t, e) { t._actions = Object.create(null), t._mutations = Object.create(null), t._wrappedGetters = Object.create(null), t._modulesNamespaceMap = Object.create(null); var n = t.state; l(t, n, [], t._modules.root, !0), u(t, n, e) } function u (e, n, o) { var r = e._state; e.getters = {}, e._makeLocalGettersCache = Object.create(null); var a = e._wrappedGetters; var c = {}; i(a, function (t, n) { c[n] = (function (t, e) { return function () { return t(e) } }(t, e)), Object.defineProperty(e.getters, n, { get: function () { return c[n]() }, enumerable: !0 }) }), e._state = t.reactive({ data: n }), e.strict && (function (e) { t.watch(function () { return e._state.data }, function () {}, { deep: !0, flush: 'sync' }) }(e)), r && o && e._withCommit(function () { r.data = null }) } function l (t, e, n, o, r) { var i = !n.length; var a = t._modules.getNamespace(n); if (o.namespaced && (t._modulesNamespaceMap[a], t._modulesNamespaceMap[a] = o), !i && !r) { var c = p(e, n.slice(0, -1)); var s = n[n.length - 1]; t._withCommit(function () { c[s] = o.state }) } var u = o.context = (function (t, e, n) { var o = e === ''; var r = { dispatch: o ? t.dispatch : function (n, o, r) { var i = d(n, o, r); var a = i.payload; var c = i.options; var s = i.type; return c && c.root || (s = e + s), t.dispatch(s, a) }, commit: o ? t.commit : function (n, o, r) { var i = d(n, o, r); var a = i.payload; var c = i.options; var s = i.type; c && c.root || (s = e + s), t.commit(s, a, c) } }; return Object.defineProperties(r, { getters: { get: o ? function () { return t.getters } : function () { return f(t, e) } }, state: { get: function () { return p(t.state, n) } } }), r }(t, a, n)); o.forEachMutation(function (e, n) { !(function (t, e, n, o) { (t._mutations[e] || (t._mutations[e] = [])).push(function (e) { n.call(t, o.state, e) }) }(t, a + n, e, u)) }), o.forEachAction(function (e, n) { var o = e.root ? n : a + n; var r = e.handler || e; !(function (t, e, n, o) { (t._actions[e] || (t._actions[e] = [])).push(function (e) { var r; var i = n.call(t, { dispatch: o.dispatch, commit: o.commit, getters: o.getters, state: o.state, rootGetters: t.getters, rootState: t.state }, e); return (r = i) && typeof r.then === 'function' || (i = Promise.resolve(i)), t._devtoolHook ? i.catch(function (e) { throw t._devtoolHook.emit('vuex:error', e), e }) : i }) }(t, o, r, u)) }), o.forEachGetter(function (e, n) { !(function (t, e, n, o) { if (t._wrappedGetters[e]) return; t._wrappedGetters[e] = function (t) { return n(o.state, o.getters, t.state, t.getters) } }(t, a + n, e, u)) }), o.forEachChild(function (o, i) { l(t, e, n.concat(i), o, r) }) } function f (t, e) { if (!t._makeLocalGettersCache[e]) { var n = {}; var o = e.length; Object.keys(t.getters).forEach(function (r) { if (r.slice(0, o) === e) { var i = r.slice(o); Object.defineProperty(n, i, { get: function () { return t.getters[r] }, enumerable: !0 }) } }), t._makeLocalGettersCache[e] = n } return t._makeLocalGettersCache[e] } function p (t, e) { return e.reduce(function (t, e) { return t[e] }, t) } function d (t, e, n) { return a(t) && t.type && (n = e, e = t, t = t.type), { type: t, payload: e, options: n } } var h = 'vuex:mutations'; var v = 'vuex:actions'; var m = 'vuex'; var g = 0; function y (t, e) { o({ id: 'org.vuejs.vuex', app: t, label: 'Vuex', homepage: 'https://next.vuex.vuejs.org/', logo: 'https://vuejs.org/images/icons/favicon-96x96.png', packageName: 'vuex', componentStateTypes: ['vuex bindings'] }, function (n) { n.addTimelineLayer({ id: h, label: 'Vuex Mutations', color: _ }), n.addTimelineLayer({ id: v, label: 'Vuex Actions', color: _ }), n.addInspector({ id: m, label: 'Vuex', icon: 'storage', treeFilterPlaceholder: 'Filter stores...' }), n.on.getInspectorTree(function (n) { if (n.app === t && n.inspectorId === m) if (n.filter) { var o = []; O(o, e._modules.root, n.filter, ''), n.rootNodes = o } else n.rootNodes = [E(e._modules.root, '')] }), n.on.getInspectorState(function (n) { if (n.app === t && n.inspectorId === m) { var o = n.nodeId; f(e, o), n.state = (function (t, e, n) { e = n === 'root' ? e : e[n]; var o = Object.keys(e); var r = { state: Object.keys(t.state).map(function (e) { return { key: e, editable: !0, value: t.state[e] } }) }; if (o.length) { var i = (function (t) { var e = {}; return Object.keys(t).forEach(function (n) { var o = n.split('/'); if (o.length > 1) { var r = e; var i = o.pop(); o.forEach(function (t) { r[t] || (r[t] = { _custom: { value: {}, display: t, tooltip: 'Module', abstract: !0 } }), r = r[t]._custom.value }), r[i] = j(function () { return t[n] }) } else e[n] = j(function () { return t[n] }) }), e }(e)); r.getters = Object.keys(i).map(function (t) { return { key: t.endsWith('/') ? w(t) : t, editable: !1, value: j(function () { return i[t] }) } }) } return r }((r = e._modules, (a = (i = o).split('/').filter(function (t) { return t })).reduce(function (t, e, n) { var o = t[e]; if (!o) throw new Error('Missing module "' + e + '" for path "' + i + '".'); return n === a.length - 1 ? o : o._children }, i === 'root' ? r : r.root._children)), o === 'root' ? e.getters : e._makeLocalGettersCache, o)) } var r, i, a }), n.on.editInspectorState(function (n) { if (n.app === t && n.inspectorId === m) { var o = n.nodeId; var r = n.path; o !== 'root' && (r = o.split('/').filter(Boolean).concat(r)), e._withCommit(function () { n.set(e._state.data, r, n.state.value) }) } }), e.subscribe(function (t, e) { var o = {}; t.payload && (o.payload = t.payload), o.state = e, n.notifyComponentUpdate(), n.sendInspectorTree(m), n.sendInspectorState(m), n.addTimelineEvent({ layerId: h, event: { time: Date.now(), title: t.type, data: o } }) }), e.subscribeAction({ before: function (t, e) { var o = {}; t.payload && (o.payload = t.payload), t._id = g++, t._time = Date.now(), o.state = e, n.addTimelineEvent({ layerId: v, event: { time: t._time, title: t.type, groupId: t._id, subtitle: 'start', data: o } }) }, after: function (t, e) { var o = {}; var r = Date.now() - t._time; o.duration = { _custom: { type: 'duration', display: r + 'ms', tooltip: 'Action duration', value: r } }, t.payload && (o.payload = t.payload), o.state = e, n.addTimelineEvent({ layerId: v, event: { time: Date.now(), title: t.type, groupId: t._id, subtitle: 'end', data: o } }) } }) }) } var _ = 8702998; var b = { label: 'namespaced', textColor: 16777215, backgroundColor: 6710886 }; function w (t) { return t && t !== 'root' ? t.split('/').slice(-2, -1)[0] : 'Root' } function E (t, e) { return { id: e || 'root', label: w(e), tags: t.namespaced ? [b] : [], children: Object.keys(t._children).map(function (n) { return E(t._children[n], e + n + '/') }) } } function O (t, e, n, o) { o.includes(n) && t.push({ id: o || 'root', label: o.endsWith('/') ? o.slice(0, o.length - 1) : o || 'Root', tags: e.namespaced ? [b] : [] }), Object.keys(e._children).forEach(function (r) { O(t, e._children[r], n, o + r + '/') }) } function j (t) { try { return t() } catch (t) { return t } } var C = function (t, e) { this.runtime = e, this._children = Object.create(null), this._rawModule = t; var n = t.state; this.state = (typeof n === 'function' ? n() : n) || {} }; var M = { namespaced: { configurable: !0 } }; M.namespaced.get = function () { return !!this._rawModule.namespaced }, C.prototype.addChild = function (t, e) { this._children[t] = e }, C.prototype.removeChild = function (t) { delete this._children[t] }, C.prototype.getChild = function (t) { return this._children[t] }, C.prototype.hasChild = function (t) { return t in this._children }, C.prototype.update = function (t) { this._rawModule.namespaced = t.namespaced, t.actions && (this._rawModule.actions = t.actions), t.mutations && (this._rawModule.mutations = t.mutations), t.getters && (this._rawModule.getters = t.getters) }, C.prototype.forEachChild = function (t) { i(this._children, t) }, C.prototype.forEachGetter = function (t) { this._rawModule.getters && i(this._rawModule.getters, t) }, C.prototype.forEachAction = function (t) { this._rawModule.actions && i(this._rawModule.actions, t) }, C.prototype.forEachMutation = function (t) { this._rawModule.mutations && i(this._rawModule.mutations, t) }, Object.defineProperties(C.prototype, M); var k = function (t) { this.register([], t, !1) }; function x (t, e, n) { if (e.update(n), n.modules) for (var o in n.modules) { if (!e.getChild(o)) return; x(t.concat(o), e.getChild(o), n.modules[o]) } }k.prototype.get = function (t) { return t.reduce(function (t, e) { return t.getChild(e) }, this.root) }, k.prototype.getNamespace = function (t) { var e = this.root; return t.reduce(function (t, n) { return t + ((e = e.getChild(n)).namespaced ? n + '/' : '') }, '') }, k.prototype.update = function (t) { x([], this.root, t) }, k.prototype.register = function (t, e, n) { var o = this; void 0 === n && (n = !0); var r = new C(e, n); t.length === 0 ? this.root = r : this.get(t.slice(0, -1)).addChild(t[t.length - 1], r); e.modules && i(e.modules, function (e, r) { o.register(t.concat(r), e, n) }) }, k.prototype.unregister = function (t) { var e = this.get(t.slice(0, -1)); var n = t[t.length - 1]; var o = e.getChild(n); o && o.runtime && e.removeChild(n) }, k.prototype.isRegistered = function (t) { var e = this.get(t.slice(0, -1)); var n = t[t.length - 1]; return !!e && e.hasChild(n) }; var S = function (t) { var e = this; void 0 === t && (t = {}); var n = t.plugins; void 0 === n && (n = []); var o = t.strict; void 0 === o && (o = !1); var r = t.devtools; this._committing = !1, this._actions = Object.create(null), this._actionSubscribers = [], this._mutations = Object.create(null), this._wrappedGetters = Object.create(null), this._modules = new k(t), this._modulesNamespaceMap = Object.create(null), this._subscribers = [], this._makeLocalGettersCache = Object.create(null), this._devtools = r; var i = this; var a = this.dispatch; var c = this.commit; this.dispatch = function (t, e) { return a.call(i, t, e) }, this.commit = function (t, e, n) { return c.call(i, t, e, n) }, this.strict = o; var s = this._modules.root.state; l(this, s, [], this._modules.root), u(this, s), n.forEach(function (t) { return t(e) }) }; var A = { state: { configurable: !0 } }; S.prototype.install = function (t, n) { t.provide(n || e, this), t.config.globalProperties.$store = this, void 0 !== this._devtools && this._devtools && y(t, this) }, A.state.get = function () { return this._state.data }, A.state.set = function (t) {}, S.prototype.commit = function (t, e, n) { var o = this; var r = d(t, e, n); var i = r.type; var a = r.payload; var c = { type: i, payload: a }; var s = this._mutations[i]; s && (this._withCommit(function () { s.forEach(function (t) { t(a) }) }), this._subscribers.slice().forEach(function (t) { return t(c, o.state) })) }, S.prototype.dispatch = function (t, e) { var n = this; var o = d(t, e); var r = o.type; var i = o.payload; var a = { type: r, payload: i }; var c = this._actions[r]; if (c) { try { this._actionSubscribers.slice().filter(function (t) { return t.before }).forEach(function (t) { return t.before(a, n.state) }) } catch (t) {} var s = c.length > 1 ? Promise.all(c.map(function (t) { return t(i) })) : c[0](i); return new Promise(function (t, e) { s.then(function (e) { try { n._actionSubscribers.filter(function (t) { return t.after }).forEach(function (t) { return t.after(a, n.state) }) } catch (t) {}t(e) }, function (t) { try { n._actionSubscribers.filter(function (t) { return t.error }).forEach(function (e) { return e.error(a, n.state, t) }) } catch (t) {}e(t) }) }) } }, S.prototype.subscribe = function (t, e) { return c(t, this._subscribers, e) }, S.prototype.subscribeAction = function (t, e) { return c(typeof t === 'function' ? { before: t } : t, this._actionSubscribers, e) }, S.prototype.watch = function (e, n, o) { var r = this; return t.watch(function () { return e(r.state, r.getters) }, n, Object.assign({}, o)) }, S.prototype.replaceState = function (t) { var e = this; this._withCommit(function () { e._state.data = t }) }, S.prototype.registerModule = function (t, e, n) { void 0 === n && (n = {}), typeof t === 'string' && (t = [t]), this._modules.register(t, e), l(this, this.state, t, this._modules.get(t), n.preserveState), u(this, this.state) }, S.prototype.unregisterModule = function (t) { var e = this; typeof t === 'string' && (t = [t]), this._modules.unregister(t), this._withCommit(function () { delete p(e.state, t.slice(0, -1))[t[t.length - 1]] }), s(this) }, S.prototype.hasModule = function (t) { return typeof t === 'string' && (t = [t]), this._modules.isRegistered(t) }, S.prototype.hotUpdate = function (t) { this._modules.update(t), s(this, !0) }, S.prototype._withCommit = function (t) { var e = this._committing; this._committing = !0, t(), this._committing = e }, Object.defineProperties(S.prototype, A); var G = P(function (t, e) { var n = {}; return T(e).forEach(function (e) { var o = e.key; var r = e.val; n[o] = function () { var e = this.$store.state; var n = this.$store.getters; if (t) { var o = V(this.$store, 'mapState', t); if (!o) return; e = o.context.state, n = o.context.getters } return typeof r === 'function' ? r.call(this, e, n) : e[r] }, n[o].vuex = !0 }), n }); var I = P(function (t, e) { var n = {}; return T(e).forEach(function (e) { var o = e.key; var r = e.val; n[o] = function () { for (var e = [], n = arguments.length; n--;)e[n] = arguments[n]; var o = this.$store.commit; if (t) { var i = V(this.$store, 'mapMutations', t); if (!i) return; o = i.context.commit } return typeof r === 'function' ? r.apply(this, [o].concat(e)) : o.apply(this.$store, [r].concat(e)) } }), n }); var L = P(function (t, e) { var n = {}; return T(e).forEach(function (e) { var o = e.key; var r = e.val; r = t + r, n[o] = function () { if (!t || V(this.$store, 'mapGetters', t)) return this.$store.getters[r] }, n[o].vuex = !0 }), n }); var N = P(function (t, e) { var n = {}; return T(e).forEach(function (e) { var o = e.key; var r = e.val; n[o] = function () { for (var e = [], n = arguments.length; n--;)e[n] = arguments[n]; var o = this.$store.dispatch; if (t) { var i = V(this.$store, 'mapActions', t); if (!i) return; o = i.context.dispatch } return typeof r === 'function' ? r.apply(this, [o].concat(e)) : o.apply(this.$store, [r].concat(e)) } }), n }); function T (t) { return (function (t) { return Array.isArray(t) || a(t) }(t)) ? Array.isArray(t) ? t.map(function (t) { return { key: t, val: t } }) : Object.keys(t).map(function (e) { return { key: e, val: t[e] } }) : [] } function P (t) { return function (e, n) { return typeof e !== 'string' ? (n = e, e = '') : e.charAt(e.length - 1) !== '/' && (e += '/'), t(e, n) } } function V (t, e, n) { return t._modulesNamespaceMap[n] } function $ (t, e, n) { var o = n ? t.groupCollapsed : t.group; try { o.call(t, e) } catch (n) { t.log(e) } } function D (t) { try { t.groupEnd() } catch (e) { t.log('—— log end ——') } } function F () { var t = new Date(); return ' @ ' + U(t.getHours(), 2) + ':' + U(t.getMinutes(), 2) + ':' + U(t.getSeconds(), 2) + '.' + U(t.getMilliseconds(), 3) } function U (t, e) { return n = '0', o = e - t.toString().length, new Array(o + 1).join(n) + t; var n, o } return { version: '4.0.2', Store: S, storeKey: e, createStore: function (t) { return new S(t) }, useStore: function (n) { return void 0 === n && (n = null), t.inject(n !== null ? n : e) }, mapState: G, mapMutations: I, mapGetters: L, mapActions: N, createNamespacedHelpers: function (t) { return { mapState: G.bind(null, t), mapGetters: L.bind(null, t), mapMutations: I.bind(null, t), mapActions: N.bind(null, t) } }, createLogger: function (t) { void 0 === t && (t = {}); var e = t.collapsed; void 0 === e && (e = !0); var n = t.filter; void 0 === n && (n = function (t, e, n) { return !0 }); var o = t.transformer; void 0 === o && (o = function (t) { return t }); var i = t.mutationTransformer; void 0 === i && (i = function (t) { return t }); var a = t.actionFilter; void 0 === a && (a = function (t, e) { return !0 }); var c = t.actionTransformer; void 0 === c && (c = function (t) { return t }); var s = t.logMutations; void 0 === s && (s = !0); var u = t.logActions; void 0 === u && (u = !0); var l = t.logger; return void 0 === l && (l = console), function (t) { var f = r(t.state); void 0 !== l && (s && t.subscribe(function (t, a) { var c = r(a); if (n(t, f, c)) { var s = F(); var u = i(t); var p = 'mutation ' + t.type + s; $(l, p, e), l.log('%c prev state', 'color: #9E9E9E; font-weight: bold', o(f)), l.log('%c mutation', 'color: #03A9F4; font-weight: bold', u), l.log('%c next state', 'color: #4CAF50; font-weight: bold', o(c)), D(l) }f = c }), u && t.subscribeAction(function (t, n) { if (a(t, n)) { var o = F(); var r = c(t); var i = 'action ' + t.type + o; $(l, i, e), l.log('%c action', 'color: #03A9F4; font-weight: bold', r), D(l) } })) } } } }(Vue))
@@ -0,0 +1,32 @@
1
+ import Vuex from '../dist/vuex.cjs.js'
2
+
3
+ const {
4
+ version,
5
+ Store,
6
+ storeKey,
7
+ createStore,
8
+ install,
9
+ useStore,
10
+ mapState,
11
+ mapMutations,
12
+ mapGetters,
13
+ mapActions,
14
+ createNamespacedHelpers,
15
+ createLogger
16
+ } = Vuex
17
+
18
+ export {
19
+ Vuex as default,
20
+ version,
21
+ Store,
22
+ storeKey,
23
+ createStore,
24
+ install,
25
+ useStore,
26
+ mapState,
27
+ mapMutations,
28
+ mapGetters,
29
+ mapActions,
30
+ createNamespacedHelpers,
31
+ createLogger
32
+ }
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "vuex",
3
+ "version": "4.0.2",
4
+ "description": "state management for Vue.js",
5
+ "main": "dist/vuex.cjs.js",
6
+ "exports": {
7
+ ".": {
8
+ "module": "./dist/vuex.esm-bundler.js",
9
+ "require": "./dist/vuex.cjs.js",
10
+ "import": "./dist/vuex.mjs"
11
+ },
12
+ "./": "./"
13
+ },
14
+ "module": "dist/vuex.esm-bundler.js",
15
+ "browser": "dist/vuex.esm-browser.js",
16
+ "unpkg": "dist/vuex.global.js",
17
+ "jsdelivr": "dist/vuex.global.js",
18
+ "typings": "types/index.d.ts",
19
+ "sideEffects": false,
20
+ "files": [
21
+ "dist",
22
+ "types/index.d.ts",
23
+ "types/helpers.d.ts",
24
+ "types/logger.d.ts",
25
+ "types/vue.d.ts"
26
+ ],
27
+ "scripts": {
28
+ "dev": "node examples/server.js",
29
+ "build": "node scripts/build.js",
30
+ "lint": "eslint src test",
31
+ "test": "npm run lint && npm run build && npm run test:types && npm run test:unit && npm run test:ssr && npm run test:e2e && npm run test:esm",
32
+ "test:unit": "jest --testPathIgnorePatterns test/e2e",
33
+ "test:e2e": "start-server-and-test dev http://localhost:8080 \"jest --testPathIgnorePatterns test/unit\"",
34
+ "test:ssr": "cross-env VUE_ENV=server jest --testPathIgnorePatterns test/e2e",
35
+ "test:types": "tsc -p types/test",
36
+ "test:esm": "node test/esm/esm-test.js",
37
+ "coverage": "jest --testPathIgnorePatterns test/e2e --coverage",
38
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
39
+ "release": "node scripts/release.js",
40
+ "docs": "vitepress dev docs",
41
+ "docs:build": "vitepress build docs",
42
+ "docs:serve": "yarn docs:build && vitepress serve docs"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/vuejs/vuex.git"
47
+ },
48
+ "author": "Evan You",
49
+ "license": "MIT",
50
+ "bugs": {
51
+ "url": "https://github.com/vuejs/vuex/issues"
52
+ },
53
+ "homepage": "https://github.com/vuejs/vuex#readme",
54
+ "peerDependencies": {
55
+ "vue": "^3.0.2"
56
+ },
57
+ "dependencies": {
58
+ "@vue/devtools-api": "^6.0.0-beta.11"
59
+ },
60
+ "devDependencies": {
61
+ "@babel/core": "^7.14.3",
62
+ "@babel/preset-env": "^7.14.2",
63
+ "@rollup/plugin-buble": "^0.21.3",
64
+ "@rollup/plugin-commonjs": "^19.0.0",
65
+ "@rollup/plugin-node-resolve": "^13.0.0",
66
+ "@rollup/plugin-replace": "^2.4.2",
67
+ "@types/node": "^15.6.0",
68
+ "@vue/compiler-sfc": "^3.0.11",
69
+ "babel-jest": "^26.6.3",
70
+ "babel-loader": "^8.2.2",
71
+ "brotli": "^1.3.2",
72
+ "chalk": "^4.1.1",
73
+ "conventional-changelog-cli": "^2.1.1",
74
+ "cross-env": "^7.0.3",
75
+ "css-loader": "^2.1.0",
76
+ "enquirer": "^2.3.5",
77
+ "eslint": "^7.27.0",
78
+ "eslint-plugin-vue-libs": "^4.0.0",
79
+ "execa": "^5.0.0",
80
+ "express": "^4.17.1",
81
+ "fs-extra": "^10.0.0",
82
+ "jest": "^26.6.3",
83
+ "puppeteer": "^9.1.1",
84
+ "regenerator-runtime": "^0.13.5",
85
+ "rollup": "^2.49.0",
86
+ "rollup-plugin-terser": "^7.0.2",
87
+ "semver": "^7.3.5",
88
+ "start-server-and-test": "^1.12.3",
89
+ "todomvc-app-css": "^2.4.1",
90
+ "typescript": "^4.2.4",
91
+ "vitepress": "^0.11.5",
92
+ "vue": "^3.0.11",
93
+ "vue-loader": "^16.2.0",
94
+ "vue-style-loader": "^4.1.3",
95
+ "webpack": "^4.43.0",
96
+ "webpack-dev-middleware": "^3.7.2",
97
+ "webpack-hot-middleware": "^2.25.0"
98
+ }
99
+ }
@@ -0,0 +1,86 @@
1
+ import { ComponentPublicInstance } from 'vue';
2
+ import { Dispatch, Commit } from './index';
3
+
4
+ type Computed = () => any;
5
+ type InlineComputed<T extends Function> = T extends (...args: any[]) => infer R ? () => R : never
6
+ type MutationMethod = (...args: any[]) => void;
7
+ type ActionMethod = (...args: any[]) => Promise<any>;
8
+ type InlineMethod<T extends (fn: any, ...args: any[]) => any> = T extends (fn: any, ...args: infer Args) => infer R ? (...args: Args) => R : never
9
+ type CustomVue = ComponentPublicInstance & Record<string, any>;
10
+
11
+ interface Mapper<R> {
12
+ <Key extends string>(map: Key[]): { [K in Key]: R };
13
+ <Map extends Record<string, string>>(map: Map): { [K in keyof Map]: R };
14
+ }
15
+
16
+ interface MapperWithNamespace<R> {
17
+ <Key extends string>(namespace: string, map: Key[]): { [K in Key]: R };
18
+ <Map extends Record<string, string>>(namespace: string, map: Map): { [K in keyof Map]: R };
19
+ }
20
+
21
+ interface MapperForState {
22
+ <S, Map extends Record<string, (this: CustomVue, state: S, getters: any) => any> = {}>(
23
+ map: Map
24
+ ): { [K in keyof Map]: InlineComputed<Map[K]> };
25
+ }
26
+
27
+ interface MapperForStateWithNamespace {
28
+ <S, Map extends Record<string, (this: CustomVue, state: S, getters: any) => any> = {}>(
29
+ namespace: string,
30
+ map: Map
31
+ ): { [K in keyof Map]: InlineComputed<Map[K]> };
32
+ }
33
+
34
+ interface MapperForAction {
35
+ <Map extends Record<string, (this: CustomVue, dispatch: Dispatch, ...args: any[]) => any>>(
36
+ map: Map
37
+ ): { [K in keyof Map]: InlineMethod<Map[K]> };
38
+ }
39
+
40
+ interface MapperForActionWithNamespace {
41
+ <Map extends Record<string, (this: CustomVue, dispatch: Dispatch, ...args: any[]) => any>>(
42
+ namespace: string,
43
+ map: Map
44
+ ): { [K in keyof Map]: InlineMethod<Map[K]> };
45
+ }
46
+
47
+ interface MapperForMutation {
48
+ <Map extends Record<string, (this: CustomVue, commit: Commit, ...args: any[]) => any>>(
49
+ map: Map
50
+ ): { [K in keyof Map]: InlineMethod<Map[K]> };
51
+ }
52
+
53
+ interface MapperForMutationWithNamespace {
54
+ <Map extends Record<string, (this: CustomVue, commit: Commit, ...args: any[]) => any>>(
55
+ namespace: string,
56
+ map: Map
57
+ ): { [K in keyof Map]: InlineMethod<Map[K]> };
58
+ }
59
+
60
+
61
+ interface NamespacedMappers {
62
+ mapState: Mapper<Computed> & MapperForState;
63
+ mapMutations: Mapper<MutationMethod> & MapperForMutation;
64
+ mapGetters: Mapper<Computed>;
65
+ mapActions: Mapper<ActionMethod> & MapperForAction;
66
+ }
67
+
68
+ export declare const mapState: Mapper<Computed>
69
+ & MapperWithNamespace<Computed>
70
+ & MapperForState
71
+ & MapperForStateWithNamespace;
72
+
73
+ export declare const mapMutations: Mapper<MutationMethod>
74
+ & MapperWithNamespace<MutationMethod>
75
+ & MapperForMutation
76
+ & MapperForMutationWithNamespace;
77
+
78
+ export declare const mapGetters: Mapper<Computed>
79
+ & MapperWithNamespace<Computed>;
80
+
81
+ export declare const mapActions: Mapper<ActionMethod>
82
+ & MapperWithNamespace<ActionMethod>
83
+ & MapperForAction
84
+ & MapperForActionWithNamespace;
85
+
86
+ export declare function createNamespacedHelpers(namespace: string): NamespacedMappers;
@@ -0,0 +1,167 @@
1
+ import { App, WatchOptions, InjectionKey } from "vue";
2
+
3
+ // augment typings of Vue.js
4
+ import "./vue";
5
+
6
+ import { mapState, mapMutations, mapGetters, mapActions, createNamespacedHelpers } from "./helpers";
7
+ import { createLogger } from "./logger";
8
+
9
+ export * from "./helpers";
10
+ export * from "./logger";
11
+
12
+ export declare class Store<S> {
13
+ constructor(options: StoreOptions<S>);
14
+
15
+ readonly state: S;
16
+ readonly getters: any;
17
+
18
+ install(app: App, injectKey?: InjectionKey<Store<any>> | string): void;
19
+
20
+ replaceState(state: S): void;
21
+
22
+ dispatch: Dispatch;
23
+ commit: Commit;
24
+
25
+ subscribe<P extends MutationPayload>(fn: (mutation: P, state: S) => any, options?: SubscribeOptions): () => void;
26
+ subscribeAction<P extends ActionPayload>(fn: SubscribeActionOptions<P, S>, options?: SubscribeOptions): () => void;
27
+ watch<T>(getter: (state: S, getters: any) => T, cb: (value: T, oldValue: T) => void, options?: WatchOptions): () => void;
28
+
29
+ registerModule<T>(path: string, module: Module<T, S>, options?: ModuleOptions): void;
30
+ registerModule<T>(path: string[], module: Module<T, S>, options?: ModuleOptions): void;
31
+
32
+ unregisterModule(path: string): void;
33
+ unregisterModule(path: string[]): void;
34
+
35
+ hasModule(path: string): boolean;
36
+ hasModule(path: string[]): boolean;
37
+
38
+ hotUpdate(options: {
39
+ actions?: ActionTree<S, S>;
40
+ mutations?: MutationTree<S>;
41
+ getters?: GetterTree<S, S>;
42
+ modules?: ModuleTree<S>;
43
+ }): void;
44
+ }
45
+
46
+ export const storeKey: string;
47
+
48
+ export function createStore<S>(options: StoreOptions<S>): Store<S>;
49
+
50
+ export function useStore<S = any>(injectKey?: InjectionKey<Store<S>> | string): Store<S>;
51
+
52
+ export interface Dispatch {
53
+ (type: string, payload?: any, options?: DispatchOptions): Promise<any>;
54
+ <P extends Payload>(payloadWithType: P, options?: DispatchOptions): Promise<any>;
55
+ }
56
+
57
+ export interface Commit {
58
+ (type: string, payload?: any, options?: CommitOptions): void;
59
+ <P extends Payload>(payloadWithType: P, options?: CommitOptions): void;
60
+ }
61
+
62
+ export interface ActionContext<S, R> {
63
+ dispatch: Dispatch;
64
+ commit: Commit;
65
+ state: S;
66
+ getters: any;
67
+ rootState: R;
68
+ rootGetters: any;
69
+ }
70
+
71
+ export interface Payload {
72
+ type: string;
73
+ }
74
+
75
+ export interface MutationPayload extends Payload {
76
+ payload: any;
77
+ }
78
+
79
+ export interface ActionPayload extends Payload {
80
+ payload: any;
81
+ }
82
+
83
+ export interface SubscribeOptions {
84
+ prepend?: boolean
85
+ }
86
+
87
+ export type ActionSubscriber<P, S> = (action: P, state: S) => any;
88
+ export type ActionErrorSubscriber<P, S> = (action: P, state: S, error: Error) => any;
89
+
90
+ export interface ActionSubscribersObject<P, S> {
91
+ before?: ActionSubscriber<P, S>;
92
+ after?: ActionSubscriber<P, S>;
93
+ error?: ActionErrorSubscriber<P, S>;
94
+ }
95
+
96
+ export type SubscribeActionOptions<P, S> = ActionSubscriber<P, S> | ActionSubscribersObject<P, S>;
97
+
98
+ export interface DispatchOptions {
99
+ root?: boolean;
100
+ }
101
+
102
+ export interface CommitOptions {
103
+ silent?: boolean;
104
+ root?: boolean;
105
+ }
106
+
107
+ export interface StoreOptions<S> {
108
+ state?: S | (() => S);
109
+ getters?: GetterTree<S, S>;
110
+ actions?: ActionTree<S, S>;
111
+ mutations?: MutationTree<S>;
112
+ modules?: ModuleTree<S>;
113
+ plugins?: Plugin<S>[];
114
+ strict?: boolean;
115
+ devtools?: boolean;
116
+ }
117
+
118
+ export type ActionHandler<S, R> = (this: Store<R>, injectee: ActionContext<S, R>, payload?: any) => any;
119
+ export interface ActionObject<S, R> {
120
+ root?: boolean;
121
+ handler: ActionHandler<S, R>;
122
+ }
123
+
124
+ export type Getter<S, R> = (state: S, getters: any, rootState: R, rootGetters: any) => any;
125
+ export type Action<S, R> = ActionHandler<S, R> | ActionObject<S, R>;
126
+ export type Mutation<S> = (state: S, payload?: any) => any;
127
+ export type Plugin<S> = (store: Store<S>) => any;
128
+
129
+ export interface Module<S, R> {
130
+ namespaced?: boolean;
131
+ state?: S | (() => S);
132
+ getters?: GetterTree<S, R>;
133
+ actions?: ActionTree<S, R>;
134
+ mutations?: MutationTree<S>;
135
+ modules?: ModuleTree<R>;
136
+ }
137
+
138
+ export interface ModuleOptions {
139
+ preserveState?: boolean;
140
+ }
141
+
142
+ export interface GetterTree<S, R> {
143
+ [key: string]: Getter<S, R>;
144
+ }
145
+
146
+ export interface ActionTree<S, R> {
147
+ [key: string]: Action<S, R>;
148
+ }
149
+
150
+ export interface MutationTree<S> {
151
+ [key: string]: Mutation<S>;
152
+ }
153
+
154
+ export interface ModuleTree<R> {
155
+ [key: string]: Module<any, R>;
156
+ }
157
+
158
+ declare const _default: {
159
+ Store: typeof Store;
160
+ mapState: typeof mapState,
161
+ mapMutations: typeof mapMutations,
162
+ mapGetters: typeof mapGetters,
163
+ mapActions: typeof mapActions,
164
+ createNamespacedHelpers: typeof createNamespacedHelpers,
165
+ createLogger: typeof createLogger
166
+ };
167
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { Payload, Plugin } from "./index";
2
+
3
+ interface Logger extends Partial<Pick<Console, 'groupCollapsed' | 'group' | 'groupEnd'>> {
4
+ log(message: string, color: string, payload: any): void;
5
+ log(message: string): void;
6
+ }
7
+
8
+ export interface LoggerOption<S> {
9
+ collapsed?: boolean;
10
+ filter?: <P extends Payload>(mutation: P, stateBefore: S, stateAfter: S) => boolean;
11
+ transformer?: (state: S) => any;
12
+ mutationTransformer?: <P extends Payload>(mutation: P) => any;
13
+ actionFilter?: <P extends Payload>(action: P, state: S) => boolean;
14
+ actionTransformer?: <P extends Payload>(action: P) => any;
15
+ logMutations?: boolean;
16
+ logActions?: boolean;
17
+ logger?: Logger;
18
+ }
19
+
20
+ export function createLogger<S>(option?: LoggerOption<S>): Plugin<S>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Extends interfaces in Vue.js
3
+ */
4
+
5
+ import { ComponentCustomOptions } from "vue";
6
+ import { Store } from "./index";
7
+
8
+ declare module "@vue/runtime-core" {
9
+ interface ComponentCustomOptions {
10
+ store?: Store<any>;
11
+ }
12
+ }