@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,961 @@
1
+ 'use strict';
2
+
3
+ var version = "3.0.0-alpha-3000020210813002";
4
+
5
+ const STAT_VERSION = version;
6
+ const STAT_URL = 'https://tongji.dcloud.io/uni/stat';
7
+ const STAT_H5_URL = 'https://tongji.dcloud.io/uni/stat.gif';
8
+ const PAGE_PVER_TIME = 1800;
9
+ const APP_PVER_TIME = 300;
10
+ const OPERATING_TIME = 10;
11
+ const DIFF_TIME = 60 * 1000 * 60 * 24;
12
+
13
+ const statConfig$1 = {
14
+ appid: process.env.UNI_APP_ID,
15
+ };
16
+ const UUID_KEY = '__DC_STAT_UUID';
17
+ const UUID_VALUE = '__DC_UUID_VALUE';
18
+
19
+ function getUuid() {
20
+ let uuid = '';
21
+ if (getPlatformName() === 'n') {
22
+ try {
23
+ uuid = plus.runtime.getDCloudId();
24
+ } catch (e) {
25
+ uuid = '';
26
+ }
27
+ return uuid
28
+ }
29
+
30
+ try {
31
+ uuid = uni.getStorageSync(UUID_KEY);
32
+ } catch (e) {
33
+ uuid = UUID_VALUE;
34
+ }
35
+
36
+ if (!uuid) {
37
+ uuid = Date.now() + '' + Math.floor(Math.random() * 1e7);
38
+ try {
39
+ uni.setStorageSync(UUID_KEY, uuid);
40
+ } catch (e) {
41
+ uni.setStorageSync(UUID_KEY, UUID_VALUE);
42
+ }
43
+ }
44
+ return uuid
45
+ }
46
+
47
+ const getSgin = (statData) => {
48
+ let arr = Object.keys(statData);
49
+ let sortArr = arr.sort();
50
+ let sgin = {};
51
+ let sginStr = '';
52
+ for (var i in sortArr) {
53
+ sgin[sortArr[i]] = statData[sortArr[i]];
54
+ sginStr += sortArr[i] + '=' + statData[sortArr[i]] + '&';
55
+ }
56
+ // const options = sginStr.substr(0, sginStr.length - 1)
57
+ // sginStr = sginStr.substr(0, sginStr.length - 1) + '&key=' + STAT_KEY;
58
+ // const si = crypto.createHash('md5').update(sginStr).digest('hex');
59
+ return {
60
+ sign: '',
61
+ options: sginStr.substr(0, sginStr.length - 1),
62
+ }
63
+ };
64
+
65
+ const getSplicing = (data) => {
66
+ let str = '';
67
+ for (var i in data) {
68
+ str += i + '=' + data[i] + '&';
69
+ }
70
+ return str.substr(0, str.length - 1)
71
+ };
72
+
73
+ const getTime = () => {
74
+ return parseInt(new Date().getTime() / 1000)
75
+ };
76
+
77
+ const getPlatformName = () => {
78
+ const aliArr = ['y', 'a', 'p', 'mp-ali'];
79
+ const platformList = {
80
+ 'app-plus': 'n',
81
+ h5: 'h5',
82
+ 'mp-weixin': 'wx',
83
+ [aliArr.reverse().join('')]: 'ali',
84
+ 'mp-baidu': 'bd',
85
+ 'mp-toutiao': 'tt',
86
+ 'mp-qq': 'qq',
87
+ 'quickapp-native': 'qn',
88
+ 'mp-kuaishou': 'ks',
89
+ };
90
+ return platformList[process.env.VUE_APP_PLATFORM]
91
+ };
92
+
93
+ const getPackName = () => {
94
+ let packName = '';
95
+ if (getPlatformName() === 'wx' || getPlatformName() === 'qq') {
96
+ // 兼容微信小程序低版本基础库
97
+ if (uni.canIUse('getAccountInfoSync')) {
98
+ packName = uni.getAccountInfoSync().miniProgram.appId || '';
99
+ }
100
+ }
101
+ return packName
102
+ };
103
+
104
+ const getVersion = () => {
105
+ return getPlatformName() === 'n' ? plus.runtime.version : ''
106
+ };
107
+
108
+ const getChannel = () => {
109
+ const platformName = getPlatformName();
110
+ let channel = '';
111
+ if (platformName === 'n') {
112
+ channel = plus.runtime.channel;
113
+ }
114
+ return channel
115
+ };
116
+
117
+ const getScene = (options) => {
118
+ const platformName = getPlatformName();
119
+ let scene = '';
120
+ if (options) {
121
+ return options
122
+ }
123
+ if (platformName === 'wx') {
124
+ scene = uni.getLaunchOptionsSync().scene;
125
+ }
126
+ return scene
127
+ };
128
+ const First__Visit__Time__KEY = 'First__Visit__Time';
129
+ const Last__Visit__Time__KEY = 'Last__Visit__Time';
130
+
131
+ const getFirstVisitTime = () => {
132
+ const timeStorge = uni.getStorageSync(First__Visit__Time__KEY);
133
+ let time = 0;
134
+ if (timeStorge) {
135
+ time = timeStorge;
136
+ } else {
137
+ time = getTime();
138
+ uni.setStorageSync(First__Visit__Time__KEY, time);
139
+ uni.removeStorageSync(Last__Visit__Time__KEY);
140
+ }
141
+ return time
142
+ };
143
+
144
+ const getLastVisitTime = () => {
145
+ const timeStorge = uni.getStorageSync(Last__Visit__Time__KEY);
146
+ let time = 0;
147
+ if (timeStorge) {
148
+ time = timeStorge;
149
+ } else {
150
+ time = '';
151
+ }
152
+ uni.setStorageSync(Last__Visit__Time__KEY, getTime());
153
+ return time
154
+ };
155
+
156
+ const PAGE_RESIDENCE_TIME = '__page__residence__time';
157
+ let First_Page_residence_time = 0;
158
+ let Last_Page_residence_time = 0;
159
+
160
+ const setPageResidenceTime = () => {
161
+ First_Page_residence_time = getTime();
162
+ if (getPlatformName() === 'n') {
163
+ uni.setStorageSync(PAGE_RESIDENCE_TIME, getTime());
164
+ }
165
+ return First_Page_residence_time
166
+ };
167
+
168
+ const getPageResidenceTime = () => {
169
+ Last_Page_residence_time = getTime();
170
+ if (getPlatformName() === 'n') {
171
+ First_Page_residence_time = uni.getStorageSync(PAGE_RESIDENCE_TIME);
172
+ }
173
+ return Last_Page_residence_time - First_Page_residence_time
174
+ };
175
+ const TOTAL__VISIT__COUNT = 'Total__Visit__Count';
176
+ const getTotalVisitCount = () => {
177
+ const timeStorge = uni.getStorageSync(TOTAL__VISIT__COUNT);
178
+ let count = 1;
179
+ if (timeStorge) {
180
+ count = timeStorge;
181
+ count++;
182
+ }
183
+ uni.setStorageSync(TOTAL__VISIT__COUNT, count);
184
+ return count
185
+ };
186
+
187
+ const GetEncodeURIComponentOptions = (statData) => {
188
+ let data = {};
189
+ for (let prop in statData) {
190
+ data[prop] = encodeURIComponent(statData[prop]);
191
+ }
192
+ return data
193
+ };
194
+
195
+ let Set__First__Time = 0;
196
+ let Set__Last__Time = 0;
197
+
198
+ const getFirstTime = () => {
199
+ let time = new Date().getTime();
200
+ Set__First__Time = time;
201
+ Set__Last__Time = 0;
202
+ return time
203
+ };
204
+
205
+ const getLastTime = () => {
206
+ let time = new Date().getTime();
207
+ Set__Last__Time = time;
208
+ return time
209
+ };
210
+
211
+ const getResidenceTime = (type) => {
212
+ let residenceTime = 0;
213
+ if (Set__First__Time !== 0) {
214
+ residenceTime = Set__Last__Time - Set__First__Time;
215
+ }
216
+
217
+ residenceTime = parseInt(residenceTime / 1000);
218
+ residenceTime = residenceTime < 1 ? 1 : residenceTime;
219
+ if (type === 'app') {
220
+ let overtime = residenceTime > APP_PVER_TIME ? true : false;
221
+ return {
222
+ residenceTime,
223
+ overtime,
224
+ }
225
+ }
226
+ if (type === 'page') {
227
+ let overtime = residenceTime > PAGE_PVER_TIME ? true : false;
228
+ return {
229
+ residenceTime,
230
+ overtime,
231
+ }
232
+ }
233
+
234
+ return {
235
+ residenceTime,
236
+ }
237
+ };
238
+
239
+ const getRoute = () => {
240
+ var pages = getCurrentPages();
241
+ var page = pages[pages.length - 1];
242
+ if (!page) return ''
243
+ // TODO 需要确认如果不用 $vm ,其他平台会不会出错
244
+ let _self = page.$vm;
245
+
246
+ if (getPlatformName() === 'bd') {
247
+ return _self.$mp && _self.$mp.page.is
248
+ } else {
249
+ return _self.route || (_self.$scope && _self.$scope.route)
250
+ }
251
+ };
252
+
253
+ const getPageRoute = (_this) => {
254
+ let pageVm = _this.self;
255
+ let page = pageVm.$page || pageVm.$scope.$page;
256
+ return page.fullPath === '/' ? page.route : page.fullPath
257
+ };
258
+
259
+ const getPageTypes = (self) => {
260
+ if (
261
+ self.$mpType === 'page' ||
262
+ (self.$mp && self.$mp.mpType === 'page') ||
263
+ self.$options.mpType === 'page'
264
+ ) {
265
+ return true
266
+ }
267
+ return false
268
+ };
269
+
270
+ const calibration = (eventName, options) => {
271
+ // login 、 share 、pay_success 、pay_fail 、register 、title
272
+ if (!eventName) {
273
+ console.error(`uni.report 缺少 [eventName] 参数`);
274
+ return true
275
+ }
276
+ if (typeof eventName !== 'string') {
277
+ console.error(`uni.report [eventName] 参数类型错误,只能为 String 类型`);
278
+ return true
279
+ }
280
+ if (eventName.length > 255) {
281
+ console.error(`uni.report [eventName] 参数长度不能大于 255`);
282
+ return true
283
+ }
284
+
285
+ if (typeof options !== 'string' && typeof options !== 'object') {
286
+ console.error(
287
+ `uni.report [options] 参数类型错误,只能为 String 或 Object 类型`
288
+ );
289
+ return true
290
+ }
291
+
292
+ if (typeof options === 'string' && options.length > 255) {
293
+ console.error(`uni.report [options] 参数长度不能大于 255`);
294
+ return true
295
+ }
296
+
297
+ if (eventName === 'title' && typeof options !== 'string') {
298
+ console.error(
299
+ 'uni.report [eventName] 参数为 title 时,[options] 参数只能为 String 类型'
300
+ );
301
+ return true
302
+ }
303
+ };
304
+
305
+ const Report_Data_Time = 'Report_Data_Time';
306
+ const Report_Status = 'Report_Status';
307
+ const isReportData = () => {
308
+ return new Promise((resolve, reject) => {
309
+ let start_time = '';
310
+ let end_time = new Date().getTime();
311
+ let diff_time = DIFF_TIME;
312
+ let report_status = 1;
313
+ try {
314
+ start_time = uni.getStorageSync(Report_Data_Time);
315
+ report_status = uni.getStorageSync(Report_Status);
316
+ } catch (e) {
317
+ start_time = '';
318
+ report_status = 1;
319
+ }
320
+
321
+ if (report_status === '') {
322
+ requestData(({ enable }) => {
323
+ uni.setStorageSync(Report_Data_Time, end_time);
324
+ uni.setStorageSync(Report_Status, enable);
325
+ if (enable === 1) {
326
+ resolve();
327
+ }
328
+ });
329
+ return
330
+ }
331
+
332
+ if (report_status === 1) {
333
+ resolve();
334
+ }
335
+
336
+ if (!start_time) {
337
+ uni.setStorageSync(Report_Data_Time, end_time);
338
+ start_time = end_time;
339
+ }
340
+
341
+ if (end_time - start_time > diff_time) {
342
+ requestData(({ enable }) => {
343
+ uni.setStorageSync(Report_Data_Time, end_time);
344
+ uni.setStorageSync(Report_Status, enable);
345
+ });
346
+ }
347
+ })
348
+ };
349
+
350
+ const requestData = (done) => {
351
+ let formData = {
352
+ usv: STAT_VERSION,
353
+ conf: JSON.stringify({
354
+ ak: statConfig$1.appid,
355
+ }),
356
+ };
357
+ uni.request({
358
+ url: STAT_URL,
359
+ method: 'GET',
360
+ data: formData,
361
+ success: (res) => {
362
+ const { data } = res;
363
+ if (data.ret === 0) {
364
+ typeof done === 'function' &&
365
+ done({
366
+ enable: data.enable,
367
+ });
368
+ }
369
+ },
370
+ fail: (e) => {
371
+ let report_status_code = 1;
372
+ try {
373
+ report_status_code = uni.getStorageSync(Report_Status);
374
+ } catch (e) {
375
+ report_status_code = 1;
376
+ }
377
+ if (report_status_code === '') {
378
+ report_status_code = 1;
379
+ }
380
+ typeof done === 'function' &&
381
+ done({
382
+ enable: report_status_code,
383
+ });
384
+ },
385
+ });
386
+ };
387
+
388
+ let titleJsons = {};
389
+ // #ifdef MP
390
+ let pagesTitle = require('uni-pages?{"type":"style"}').default;
391
+ pagesTitle = pagesTitle.pages;
392
+ for (let i in pagesTitle) {
393
+ titleJsons[i] = pagesTitle[i].navigationBarTitleText || '';
394
+ }
395
+ // #endif
396
+ // #ifndef MP
397
+ titleJsons = process.env.UNI_STAT_TITLE_JSON;
398
+ // #endif
399
+
400
+ const statConfig = {
401
+ appid: process.env.UNI_APP_ID,
402
+ };
403
+ const resultOptions = uni.getSystemInfoSync();
404
+
405
+ class Util {
406
+ constructor() {
407
+ this.self = '';
408
+ this._retry = 0;
409
+ this._platform = '';
410
+ this._query = {};
411
+ this._navigationBarTitle = {
412
+ config: '',
413
+ page: '',
414
+ report: '',
415
+ lt: '',
416
+ };
417
+ this._operatingTime = 0;
418
+ this._reportingRequestData = {
419
+ 1: [],
420
+ 11: [],
421
+ };
422
+ this.__prevent_triggering = false;
423
+
424
+ this.__licationHide = false;
425
+ this.__licationShow = false;
426
+ this._lastPageRoute = '';
427
+ this.statData = {
428
+ uuid: getUuid(),
429
+ ut: getPlatformName(),
430
+ mpn: getPackName(),
431
+ ak: statConfig.appid,
432
+ usv: STAT_VERSION,
433
+ v: getVersion(),
434
+ ch: getChannel(),
435
+ cn: '',
436
+ pn: '',
437
+ ct: '',
438
+ t: getTime(),
439
+ tt: '',
440
+ p: resultOptions.platform === 'android' ? 'a' : 'i',
441
+ brand: resultOptions.brand || '',
442
+ md: resultOptions.model,
443
+ sv: resultOptions.system.replace(/(Android|iOS)\s/, ''),
444
+ mpsdk: resultOptions.SDKVersion || '',
445
+ mpv: resultOptions.version || '',
446
+ lang: resultOptions.language,
447
+ pr: resultOptions.pixelRatio,
448
+ ww: resultOptions.windowWidth,
449
+ wh: resultOptions.windowHeight,
450
+ sw: resultOptions.screenWidth,
451
+ sh: resultOptions.screenHeight,
452
+ };
453
+ // 注册拦截器
454
+ let registerInterceptor =
455
+ typeof uni.addInterceptor === 'function' &&
456
+ process.env.NODE_ENV !== 'development';
457
+ if (registerInterceptor) {
458
+ this.addInterceptorInit();
459
+ this.interceptLogin();
460
+ this.interceptShare(true);
461
+ this.interceptRequestPayment();
462
+ }
463
+ }
464
+
465
+ addInterceptorInit() {
466
+ let self = this;
467
+ uni.addInterceptor('setNavigationBarTitle', {
468
+ invoke(args) {
469
+ self._navigationBarTitle.page = args.title;
470
+ },
471
+ });
472
+ }
473
+
474
+ interceptLogin() {
475
+ let self = this;
476
+ uni.addInterceptor('login', {
477
+ complete() {
478
+ self._login();
479
+ },
480
+ });
481
+ }
482
+
483
+ interceptShare(type) {
484
+ let self = this;
485
+ if (!type) {
486
+ self._share();
487
+ return
488
+ }
489
+ uni.addInterceptor('share', {
490
+ success() {
491
+ self._share();
492
+ },
493
+ fail() {
494
+ self._share();
495
+ },
496
+ });
497
+ }
498
+
499
+ interceptRequestPayment() {
500
+ let self = this;
501
+ uni.addInterceptor('requestPayment', {
502
+ success() {
503
+ self._payment('pay_success');
504
+ },
505
+ fail() {
506
+ self._payment('pay_fail');
507
+ },
508
+ });
509
+ }
510
+
511
+ getIsReportData() {
512
+ return isReportData()
513
+ }
514
+
515
+ _applicationShow() {
516
+ if (this.__licationHide) {
517
+ getLastTime();
518
+ const time = getResidenceTime('app');
519
+ if (time.overtime) {
520
+ let options = {
521
+ path: this._lastPageRoute,
522
+ scene: this.statData.sc,
523
+ };
524
+ this._sendReportRequest(options);
525
+ }
526
+ this.__licationHide = false;
527
+ }
528
+ }
529
+
530
+ _applicationHide(self, type) {
531
+ this.__licationHide = true;
532
+ getLastTime();
533
+ const time = getResidenceTime();
534
+ getFirstTime();
535
+ const route = getPageRoute(this);
536
+ this._sendHideRequest(
537
+ {
538
+ urlref: route,
539
+ urlref_ts: time.residenceTime,
540
+ },
541
+ type
542
+ );
543
+ }
544
+
545
+ _pageShow() {
546
+ const route = getPageRoute(this);
547
+ const routepath = getRoute();
548
+ this._navigationBarTitle.config =
549
+ (titleJsons && titleJsons[routepath]) || '';
550
+ if (this.__licationShow) {
551
+ getFirstTime();
552
+ this.__licationShow = false;
553
+ this._lastPageRoute = route;
554
+ return
555
+ }
556
+
557
+ getLastTime();
558
+ const time = getResidenceTime('page');
559
+ // 停留时间
560
+ if (time.overtime) {
561
+ let options = {
562
+ path: route,
563
+ scene: this.statData.sc,
564
+ };
565
+ this._sendReportRequest(options);
566
+ }
567
+ getFirstTime();
568
+ }
569
+
570
+ _pageHide() {
571
+ if (!this.__licationHide) {
572
+ getLastTime();
573
+ const time = getResidenceTime('page');
574
+ let route = getPageRoute(this);
575
+ if (!this._lastPageRoute) {
576
+ this._lastPageRoute = route;
577
+ }
578
+ this._sendPageRequest({
579
+ url: route,
580
+ urlref: this._lastPageRoute,
581
+ urlref_ts: time.residenceTime,
582
+ });
583
+ this._lastPageRoute = route;
584
+ this._navigationBarTitle = {
585
+ config: '',
586
+ page: '',
587
+ report: '',
588
+ lt: '',
589
+ };
590
+ return
591
+ }
592
+ }
593
+
594
+ _login() {
595
+ this._sendEventRequest(
596
+ {
597
+ key: 'login',
598
+ },
599
+ 0
600
+ );
601
+ }
602
+
603
+ _share() {
604
+ this._sendEventRequest(
605
+ {
606
+ key: 'share',
607
+ },
608
+ 0
609
+ );
610
+ }
611
+ _payment(key) {
612
+ this._sendEventRequest(
613
+ {
614
+ key,
615
+ },
616
+ 0
617
+ );
618
+ }
619
+ _sendReportRequest(options) {
620
+ this._navigationBarTitle.lt = '1';
621
+ this._navigationBarTitle.config =
622
+ (titleJsons && titleJsons[options.path]) || '';
623
+ let query =
624
+ options.query && JSON.stringify(options.query) !== '{}'
625
+ ? '?' + JSON.stringify(options.query)
626
+ : '';
627
+ this.statData.lt = '1';
628
+ this.statData.url = options.path + query || '';
629
+ this.statData.t = getTime();
630
+ this.statData.sc = getScene(options.scene);
631
+ this.statData.fvts = getFirstVisitTime();
632
+ this.statData.lvts = getLastVisitTime();
633
+ this.statData.tvc = getTotalVisitCount();
634
+ if (getPlatformName() === 'n') {
635
+ this.getProperty();
636
+ } else {
637
+ this.getNetworkInfo();
638
+ }
639
+ }
640
+
641
+ _sendPageRequest(opt) {
642
+ let { url, urlref, urlref_ts } = opt;
643
+ this._navigationBarTitle.lt = '11';
644
+ let options = {
645
+ ak: this.statData.ak,
646
+ uuid: this.statData.uuid,
647
+ lt: '11',
648
+ ut: this.statData.ut,
649
+ url,
650
+ tt: this.statData.tt,
651
+ urlref,
652
+ urlref_ts,
653
+ ch: this.statData.ch,
654
+ usv: this.statData.usv,
655
+ t: getTime(),
656
+ p: this.statData.p,
657
+ };
658
+ this.request(options);
659
+ }
660
+
661
+ _sendHideRequest(opt, type) {
662
+ let { urlref, urlref_ts } = opt;
663
+ let options = {
664
+ ak: this.statData.ak,
665
+ uuid: this.statData.uuid,
666
+ lt: '3',
667
+ ut: this.statData.ut,
668
+ urlref,
669
+ urlref_ts,
670
+ ch: this.statData.ch,
671
+ usv: this.statData.usv,
672
+ t: getTime(),
673
+ p: this.statData.p,
674
+ };
675
+ this.request(options, type);
676
+ }
677
+ _sendEventRequest({ key = '', value = '' } = {}) {
678
+ const route = this._lastPageRoute;
679
+ let options = {
680
+ ak: this.statData.ak,
681
+ uuid: this.statData.uuid,
682
+ lt: '21',
683
+ ut: this.statData.ut,
684
+ url: route,
685
+ ch: this.statData.ch,
686
+ e_n: key,
687
+ e_v: typeof value === 'object' ? JSON.stringify(value) : value.toString(),
688
+ usv: this.statData.usv,
689
+ t: getTime(),
690
+ p: this.statData.p,
691
+ };
692
+ this.request(options);
693
+ }
694
+
695
+ getNetworkInfo() {
696
+ uni.getNetworkType({
697
+ success: (result) => {
698
+ this.statData.net = result.networkType;
699
+ this.getLocation();
700
+ },
701
+ });
702
+ }
703
+
704
+ getProperty() {
705
+ plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
706
+ this.statData.v = wgtinfo.version || '';
707
+ this.getNetworkInfo();
708
+ });
709
+ }
710
+
711
+ getLocation() {
712
+ {
713
+ this.statData.lat = 0;
714
+ this.statData.lng = 0;
715
+ this.request(this.statData);
716
+ }
717
+ }
718
+
719
+ request(data, type) {
720
+ let time = getTime();
721
+ const title = this._navigationBarTitle;
722
+ data.ttn = title.page;
723
+ data.ttpj = title.config;
724
+ data.ttc = title.report;
725
+ let requestData = this._reportingRequestData;
726
+ if (getPlatformName() === 'n') {
727
+ requestData = uni.getStorageSync('__UNI__STAT__DATA') || {};
728
+ }
729
+ if (!requestData[data.lt]) {
730
+ requestData[data.lt] = [];
731
+ }
732
+ requestData[data.lt].push(data);
733
+ if (getPlatformName() === 'n') {
734
+ uni.setStorageSync('__UNI__STAT__DATA', requestData);
735
+ }
736
+ if (getPageResidenceTime() < OPERATING_TIME && !type) {
737
+ return
738
+ }
739
+ let uniStatData = this._reportingRequestData;
740
+ if (getPlatformName() === 'n') {
741
+ uniStatData = uni.getStorageSync('__UNI__STAT__DATA');
742
+ }
743
+ // 时间超过,重新获取时间戳
744
+ setPageResidenceTime();
745
+ let firstArr = [];
746
+ let contentArr = [];
747
+ let lastArr = [];
748
+
749
+ for (let i in uniStatData) {
750
+ const rd = uniStatData[i];
751
+ rd.forEach((elm) => {
752
+ const newData = getSplicing(elm);
753
+ if (i === 0) {
754
+ firstArr.push(newData);
755
+ } else if (i === 3) {
756
+ lastArr.push(newData);
757
+ } else {
758
+ contentArr.push(newData);
759
+ }
760
+ });
761
+ }
762
+
763
+ firstArr.push(...contentArr, ...lastArr);
764
+ let optionsData = {
765
+ usv: STAT_VERSION, //统计 SDK 版本号
766
+ t: time, //发送请求时的时间戮
767
+ requests: JSON.stringify(firstArr),
768
+ };
769
+
770
+ this._reportingRequestData = {};
771
+ if (getPlatformName() === 'n') {
772
+ uni.removeStorageSync('__UNI__STAT__DATA');
773
+ }
774
+
775
+ if (data.ut === 'h5') {
776
+ this.imageRequest(optionsData);
777
+ return
778
+ }
779
+
780
+ if (getPlatformName() === 'n' && this.statData.p === 'a') {
781
+ setTimeout(() => {
782
+ this._sendRequest(optionsData);
783
+ }, 200);
784
+ return
785
+ }
786
+ this._sendRequest(optionsData);
787
+ }
788
+ _sendRequest(optionsData) {
789
+ this.getIsReportData().then(() => {
790
+ uni.request({
791
+ url: STAT_URL,
792
+ method: 'POST',
793
+ data: optionsData,
794
+ success: () => {},
795
+ fail: (e) => {
796
+ if (++this._retry < 3) {
797
+ setTimeout(() => {
798
+ this._sendRequest(optionsData);
799
+ }, 1000);
800
+ }
801
+ },
802
+ });
803
+ });
804
+ }
805
+ /**
806
+ * h5 请求
807
+ */
808
+ imageRequest(data) {
809
+ this.getIsReportData().then(() => {
810
+ let image = new Image();
811
+ let options = getSgin(GetEncodeURIComponentOptions(data)).options;
812
+ image.src = STAT_H5_URL + '?' + options;
813
+ });
814
+ }
815
+
816
+ sendEvent(key, value) {
817
+ // 校验 type 参数
818
+ if (calibration(key, value)) return
819
+
820
+ if (key === 'title') {
821
+ this._navigationBarTitle.report = value;
822
+ return
823
+ }
824
+ this._sendEventRequest(
825
+ {
826
+ key,
827
+ value: typeof value === 'object' ? JSON.stringify(value) : value,
828
+ },
829
+ 1
830
+ );
831
+ }
832
+ }
833
+
834
+ class Stat extends Util {
835
+ static getInstance() {
836
+ if (!this.instance) {
837
+ this.instance = new Stat();
838
+ }
839
+ return this.instance
840
+ }
841
+ constructor() {
842
+ super();
843
+ this.instance = null;
844
+ }
845
+
846
+ report(options, self) {
847
+ // TODO 需要确认如果不用 $vm ,其他平台会不会出错
848
+ setPageResidenceTime();
849
+ this.__licationShow = true;
850
+ this._sendReportRequest(options, true);
851
+ }
852
+
853
+ load(options, self) {
854
+ this.self = self;
855
+ this._query = options;
856
+ }
857
+
858
+ show(self) {
859
+ this.self = self;
860
+ if (getPageTypes(self)) {
861
+ this._pageShow(self);
862
+ } else {
863
+ this._applicationShow(self);
864
+ }
865
+ }
866
+ ready(self) {}
867
+ hide(self) {
868
+ this.self = self;
869
+ if (getPageTypes(self)) {
870
+ this._pageHide(self);
871
+ } else {
872
+ this._applicationHide(self, true);
873
+ }
874
+ }
875
+ error(em) {
876
+ if (this._platform === 'devtools') {
877
+ if (process.env.NODE_ENV === 'development') {
878
+ console.info('当前运行环境为开发者工具,不上报数据。');
879
+ }
880
+ }
881
+ let emVal = '';
882
+ if (!em.message) {
883
+ emVal = JSON.stringify(em);
884
+ } else {
885
+ emVal = em.stack;
886
+ }
887
+ let options = {
888
+ ak: this.statData.ak,
889
+ uuid: this.statData.uuid,
890
+ lt: '31',
891
+ ut: this.statData.ut,
892
+ ch: this.statData.ch,
893
+ mpsdk: this.statData.mpsdk,
894
+ mpv: this.statData.mpv,
895
+ v: this.statData.v,
896
+ em: emVal,
897
+ usv: this.statData.usv,
898
+ t: getTime(),
899
+ p: this.statData.p,
900
+ };
901
+ this.request(options);
902
+ }
903
+ }
904
+ var Stat$1 = Stat;
905
+
906
+ const stat = Stat$1.getInstance();
907
+ let isHide = false;
908
+ const lifecycle = {
909
+ onLaunch(options) {
910
+ stat.report(options, this);
911
+ },
912
+ onReady() {
913
+ stat.ready(this);
914
+ },
915
+ onLoad(options) {
916
+ stat.load(options, this);
917
+ // 重写分享,获取分享上报事件
918
+ if (this.$scope && this.$scope.onShareAppMessage) {
919
+ let oldShareAppMessage = this.$scope.onShareAppMessage;
920
+ this.$scope.onShareAppMessage = function (options) {
921
+ stat.interceptShare(false);
922
+ return oldShareAppMessage.call(this, options)
923
+ };
924
+ }
925
+ },
926
+ onShow() {
927
+ isHide = false;
928
+ stat.show(this);
929
+ },
930
+ onHide() {
931
+ isHide = true;
932
+ stat.hide(this);
933
+ },
934
+ onUnload() {
935
+ if (isHide) {
936
+ isHide = false;
937
+ return
938
+ }
939
+ stat.hide(this);
940
+ },
941
+ onError(e) {
942
+ stat.error(e);
943
+ },
944
+ };
945
+
946
+ function main() {
947
+ if (process.env.NODE_ENV === 'development') {
948
+ uni.report = function (type, options) {};
949
+ } else {
950
+ uni.onAppLaunch((options) => {
951
+ stat.report(options);
952
+ // 小程序平台此时也无法获取getApp,统一在options中传递一个app对象
953
+ options.app.$vm.$.appContext.app.mixin(lifecycle);
954
+ uni.report = function (type, options) {
955
+ stat.sendEvent(type, options);
956
+ };
957
+ });
958
+ }
959
+ }
960
+
961
+ main();