@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,965 @@
1
+ /*!
2
+ * @intlify/core-base v9.1.7
3
+ * (c) 2021 kazuya kawaguchi
4
+ * Released under the MIT License.
5
+ */
6
+ import { format, isString, isArray, isPlainObject, assign, isFunction, isBoolean, isRegExp, warn, isObject, escapeHtml, inBrowser, mark, measure, generateCodeFrame, generateFormatCacheKey, isNumber, isEmptyObject, isDate, getGlobalThis } from '@intlify/shared';
7
+ import { resolveValue } from '@intlify/message-resolver';
8
+ export * from '@intlify/message-resolver';
9
+ import { createMessageContext } from '@intlify/runtime';
10
+ export * from '@intlify/runtime';
11
+ import { defaultOnError, baseCompile, createCompileError } from '@intlify/message-compiler';
12
+ export { createCompileError } from '@intlify/message-compiler';
13
+ import { IntlifyDevToolsHooks } from '@intlify/devtools-if';
14
+
15
+ let devtools = null;
16
+ function setDevToolsHook(hook) {
17
+ devtools = hook;
18
+ }
19
+ function getDevToolsHook() {
20
+ return devtools;
21
+ }
22
+ function initI18nDevTools(i18n, version, meta) {
23
+ // TODO: queue if devtools is undefined
24
+ devtools &&
25
+ devtools.emit(IntlifyDevToolsHooks.I18nInit, {
26
+ timestamp: Date.now(),
27
+ i18n,
28
+ version,
29
+ meta
30
+ });
31
+ }
32
+ const translateDevTools = /* #__PURE__*/ createDevToolsHook(IntlifyDevToolsHooks.FunctionTranslate);
33
+ function createDevToolsHook(hook) {
34
+ return (payloads) => devtools && devtools.emit(hook, payloads);
35
+ }
36
+
37
+ /** @internal */
38
+ const warnMessages = {
39
+ [0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
40
+ [1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
41
+ [2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
42
+ [3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
43
+ [4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
44
+ [5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
45
+ };
46
+ function getWarnMessage(code, ...args) {
47
+ return format(warnMessages[code], ...args);
48
+ }
49
+
50
+ /**
51
+ * Intlify core-base version
52
+ * @internal
53
+ */
54
+ const VERSION = '9.1.7';
55
+ const NOT_REOSLVED = -1;
56
+ const MISSING_RESOLVE_VALUE = '';
57
+ function getDefaultLinkedModifiers() {
58
+ return {
59
+ upper: (val) => (isString(val) ? val.toUpperCase() : val),
60
+ lower: (val) => (isString(val) ? val.toLowerCase() : val),
61
+ // prettier-ignore
62
+ capitalize: (val) => (isString(val)
63
+ ? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
64
+ : val)
65
+ };
66
+ }
67
+ let _compiler;
68
+ function registerMessageCompiler(compiler) {
69
+ _compiler = compiler;
70
+ }
71
+ // Additional Meta for Intlify DevTools
72
+ let _additionalMeta = null;
73
+ const setAdditionalMeta = /* #__PURE__*/ (meta) => {
74
+ _additionalMeta = meta;
75
+ };
76
+ const getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;
77
+ // ID for CoreContext
78
+ let _cid = 0;
79
+ function createCoreContext(options = {}) {
80
+ // setup options
81
+ const version = isString(options.version) ? options.version : VERSION;
82
+ const locale = isString(options.locale) ? options.locale : 'en-US';
83
+ const fallbackLocale = isArray(options.fallbackLocale) ||
84
+ isPlainObject(options.fallbackLocale) ||
85
+ isString(options.fallbackLocale) ||
86
+ options.fallbackLocale === false
87
+ ? options.fallbackLocale
88
+ : locale;
89
+ const messages = isPlainObject(options.messages)
90
+ ? options.messages
91
+ : { [locale]: {} };
92
+ const datetimeFormats = isPlainObject(options.datetimeFormats)
93
+ ? options.datetimeFormats
94
+ : { [locale]: {} };
95
+ const numberFormats = isPlainObject(options.numberFormats)
96
+ ? options.numberFormats
97
+ : { [locale]: {} };
98
+ const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
99
+ const pluralRules = options.pluralRules || {};
100
+ const missing = isFunction(options.missing) ? options.missing : null;
101
+ const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
102
+ ? options.missingWarn
103
+ : true;
104
+ const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
105
+ ? options.fallbackWarn
106
+ : true;
107
+ const fallbackFormat = !!options.fallbackFormat;
108
+ const unresolving = !!options.unresolving;
109
+ const postTranslation = isFunction(options.postTranslation)
110
+ ? options.postTranslation
111
+ : null;
112
+ const processor = isPlainObject(options.processor) ? options.processor : null;
113
+ const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
114
+ ? options.warnHtmlMessage
115
+ : true;
116
+ const escapeParameter = !!options.escapeParameter;
117
+ const messageCompiler = isFunction(options.messageCompiler)
118
+ ? options.messageCompiler
119
+ : _compiler;
120
+ const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
121
+ // setup internal options
122
+ const internalOptions = options;
123
+ const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
124
+ ? internalOptions.__datetimeFormatters
125
+ : new Map();
126
+ const __numberFormatters = isObject(internalOptions.__numberFormatters)
127
+ ? internalOptions.__numberFormatters
128
+ : new Map();
129
+ const __meta = isObject(internalOptions.__meta) ? internalOptions.__meta : {};
130
+ _cid++;
131
+ const context = {
132
+ version,
133
+ cid: _cid,
134
+ locale,
135
+ fallbackLocale,
136
+ messages,
137
+ datetimeFormats,
138
+ numberFormats,
139
+ modifiers,
140
+ pluralRules,
141
+ missing,
142
+ missingWarn,
143
+ fallbackWarn,
144
+ fallbackFormat,
145
+ unresolving,
146
+ postTranslation,
147
+ processor,
148
+ warnHtmlMessage,
149
+ escapeParameter,
150
+ messageCompiler,
151
+ onWarn,
152
+ __datetimeFormatters,
153
+ __numberFormatters,
154
+ __meta
155
+ };
156
+ // for vue-devtools timeline event
157
+ if ((process.env.NODE_ENV !== 'production')) {
158
+ context.__v_emitter =
159
+ internalOptions.__v_emitter != null
160
+ ? internalOptions.__v_emitter
161
+ : undefined;
162
+ }
163
+ // NOTE: experimental !!
164
+ if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {
165
+ initI18nDevTools(context, version, __meta);
166
+ }
167
+ return context;
168
+ }
169
+ /** @internal */
170
+ function isTranslateFallbackWarn(fallback, key) {
171
+ return fallback instanceof RegExp ? fallback.test(key) : fallback;
172
+ }
173
+ /** @internal */
174
+ function isTranslateMissingWarn(missing, key) {
175
+ return missing instanceof RegExp ? missing.test(key) : missing;
176
+ }
177
+ /** @internal */
178
+ function handleMissing(context, key, locale, missingWarn, type) {
179
+ const { missing, onWarn } = context;
180
+ // for vue-devtools timeline event
181
+ if ((process.env.NODE_ENV !== 'production')) {
182
+ const emitter = context.__v_emitter;
183
+ if (emitter) {
184
+ emitter.emit("missing" /* MISSING */, {
185
+ locale,
186
+ key,
187
+ type,
188
+ groupId: `${type}:${key}`
189
+ });
190
+ }
191
+ }
192
+ if (missing !== null) {
193
+ const ret = missing(context, locale, key, type);
194
+ return isString(ret) ? ret : key;
195
+ }
196
+ else {
197
+ if ((process.env.NODE_ENV !== 'production') && isTranslateMissingWarn(missingWarn, key)) {
198
+ onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
199
+ }
200
+ return key;
201
+ }
202
+ }
203
+ /** @internal */
204
+ function getLocaleChain(ctx, fallback, start) {
205
+ const context = ctx;
206
+ if (!context.__localeChainCache) {
207
+ context.__localeChainCache = new Map();
208
+ }
209
+ let chain = context.__localeChainCache.get(start);
210
+ if (!chain) {
211
+ chain = [];
212
+ // first block defined by start
213
+ let block = [start];
214
+ // while any intervening block found
215
+ while (isArray(block)) {
216
+ block = appendBlockToChain(chain, block, fallback);
217
+ }
218
+ // prettier-ignore
219
+ // last block defined by default
220
+ const defaults = isArray(fallback)
221
+ ? fallback
222
+ : isPlainObject(fallback)
223
+ ? fallback['default']
224
+ ? fallback['default']
225
+ : null
226
+ : fallback;
227
+ // convert defaults to array
228
+ block = isString(defaults) ? [defaults] : defaults;
229
+ if (isArray(block)) {
230
+ appendBlockToChain(chain, block, false);
231
+ }
232
+ context.__localeChainCache.set(start, chain);
233
+ }
234
+ return chain;
235
+ }
236
+ function appendBlockToChain(chain, block, blocks) {
237
+ let follow = true;
238
+ for (let i = 0; i < block.length && isBoolean(follow); i++) {
239
+ const locale = block[i];
240
+ if (isString(locale)) {
241
+ follow = appendLocaleToChain(chain, block[i], blocks);
242
+ }
243
+ }
244
+ return follow;
245
+ }
246
+ function appendLocaleToChain(chain, locale, blocks) {
247
+ let follow;
248
+ const tokens = locale.split('-');
249
+ do {
250
+ const target = tokens.join('-');
251
+ follow = appendItemToChain(chain, target, blocks);
252
+ tokens.splice(-1, 1);
253
+ } while (tokens.length && follow === true);
254
+ return follow;
255
+ }
256
+ function appendItemToChain(chain, target, blocks) {
257
+ let follow = false;
258
+ if (!chain.includes(target)) {
259
+ follow = true;
260
+ if (target) {
261
+ follow = target[target.length - 1] !== '!';
262
+ const locale = target.replace(/!/g, '');
263
+ chain.push(locale);
264
+ if ((isArray(blocks) || isPlainObject(blocks)) &&
265
+ blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
266
+ ) {
267
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
+ follow = blocks[locale];
269
+ }
270
+ }
271
+ }
272
+ return follow;
273
+ }
274
+ /** @internal */
275
+ function updateFallbackLocale(ctx, locale, fallback) {
276
+ const context = ctx;
277
+ context.__localeChainCache = new Map();
278
+ getLocaleChain(ctx, fallback, locale);
279
+ }
280
+
281
+ const RE_HTML_TAG = /<\/?[\w\s="/.':;#-\/]+>/;
282
+ const WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;
283
+ function checkHtmlMessage(source, options) {
284
+ const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
285
+ ? options.warnHtmlMessage
286
+ : true;
287
+ if (warnHtmlMessage && RE_HTML_TAG.test(source)) {
288
+ warn(format(WARN_MESSAGE, { source }));
289
+ }
290
+ }
291
+ const defaultOnCacheKey = (source) => source;
292
+ let compileCache = Object.create(null);
293
+ function clearCompileCache() {
294
+ compileCache = Object.create(null);
295
+ }
296
+ function compileToFunction(source, options = {}) {
297
+ {
298
+ // check HTML message
299
+ (process.env.NODE_ENV !== 'production') && checkHtmlMessage(source, options);
300
+ // check caches
301
+ const onCacheKey = options.onCacheKey || defaultOnCacheKey;
302
+ const key = onCacheKey(source);
303
+ const cached = compileCache[key];
304
+ if (cached) {
305
+ return cached;
306
+ }
307
+ // compile error detecting
308
+ let occurred = false;
309
+ const onError = options.onError || defaultOnError;
310
+ options.onError = (err) => {
311
+ occurred = true;
312
+ onError(err);
313
+ };
314
+ // compile
315
+ const { code } = baseCompile(source, options);
316
+ // evaluate function
317
+ const msg = new Function(`return ${code}`)();
318
+ // if occurred compile error, don't cache
319
+ return !occurred ? (compileCache[key] = msg) : msg;
320
+ }
321
+ }
322
+
323
+ function createCoreError(code) {
324
+ return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages } : undefined);
325
+ }
326
+ /** @internal */
327
+ const errorMessages = {
328
+ [14 /* INVALID_ARGUMENT */]: 'Invalid arguments',
329
+ [15 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
330
+ 'Make sure your Date represents a valid date.',
331
+ [16 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
332
+ };
333
+
334
+ const NOOP_MESSAGE_FUNCTION = () => '';
335
+ const isMessageFunction = (val) => isFunction(val);
336
+ // implementation of `translate` function
337
+ function translate(context, ...args) {
338
+ const { fallbackFormat, postTranslation, unresolving, fallbackLocale, messages } = context;
339
+ const [key, options] = parseTranslateArgs(...args);
340
+ const missingWarn = isBoolean(options.missingWarn)
341
+ ? options.missingWarn
342
+ : context.missingWarn;
343
+ const fallbackWarn = isBoolean(options.fallbackWarn)
344
+ ? options.fallbackWarn
345
+ : context.fallbackWarn;
346
+ const escapeParameter = isBoolean(options.escapeParameter)
347
+ ? options.escapeParameter
348
+ : context.escapeParameter;
349
+ const resolvedMessage = !!options.resolvedMessage;
350
+ // prettier-ignore
351
+ const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) // default by function option
352
+ ? !isBoolean(options.default)
353
+ ? options.default
354
+ : key
355
+ : fallbackFormat // default by `fallbackFormat` option
356
+ ? key
357
+ : '';
358
+ const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
359
+ const locale = isString(options.locale) ? options.locale : context.locale;
360
+ // escape params
361
+ escapeParameter && escapeParams(options);
362
+ // resolve message format
363
+ // eslint-disable-next-line prefer-const
364
+ let [format, targetLocale, message] = !resolvedMessage
365
+ ? resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn)
366
+ : [
367
+ key,
368
+ locale,
369
+ messages[locale] || {}
370
+ ];
371
+ // if you use default message, set it as message format!
372
+ let cacheBaseKey = key;
373
+ if (!resolvedMessage &&
374
+ !(isString(format) || isMessageFunction(format))) {
375
+ if (enableDefaultMsg) {
376
+ format = defaultMsgOrKey;
377
+ cacheBaseKey = format;
378
+ }
379
+ }
380
+ // checking message format and target locale
381
+ if (!resolvedMessage &&
382
+ (!(isString(format) || isMessageFunction(format)) ||
383
+ !isString(targetLocale))) {
384
+ return unresolving ? NOT_REOSLVED : key;
385
+ }
386
+ if ((process.env.NODE_ENV !== 'production') && isString(format) && context.messageCompiler == null) {
387
+ warn(`The message format compilation is not supported in this build. ` +
388
+ `Because message compiler isn't included. ` +
389
+ `You need to pre-compilation all message format. ` +
390
+ `So translate function return '${key}'.`);
391
+ return key;
392
+ }
393
+ // setup compile error detecting
394
+ let occurred = false;
395
+ const errorDetector = () => {
396
+ occurred = true;
397
+ };
398
+ // compile message format
399
+ const msg = !isMessageFunction(format)
400
+ ? compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector)
401
+ : format;
402
+ // if occurred compile error, return the message format
403
+ if (occurred) {
404
+ return format;
405
+ }
406
+ // evaluate message with context
407
+ const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
408
+ const msgContext = createMessageContext(ctxOptions);
409
+ const messaged = evaluateMessage(context, msg, msgContext);
410
+ // if use post translation option, proceed it with handler
411
+ const ret = postTranslation ? postTranslation(messaged) : messaged;
412
+ // NOTE: experimental !!
413
+ if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {
414
+ // prettier-ignore
415
+ const payloads = {
416
+ timestamp: Date.now(),
417
+ key: isString(key)
418
+ ? key
419
+ : isMessageFunction(format)
420
+ ? format.key
421
+ : '',
422
+ locale: targetLocale || (isMessageFunction(format)
423
+ ? format.locale
424
+ : ''),
425
+ format: isString(format)
426
+ ? format
427
+ : isMessageFunction(format)
428
+ ? format.source
429
+ : '',
430
+ message: ret
431
+ };
432
+ payloads.meta = assign({}, context.__meta, getAdditionalMeta() || {});
433
+ translateDevTools(payloads);
434
+ }
435
+ return ret;
436
+ }
437
+ function escapeParams(options) {
438
+ if (isArray(options.list)) {
439
+ options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);
440
+ }
441
+ else if (isObject(options.named)) {
442
+ Object.keys(options.named).forEach(key => {
443
+ if (isString(options.named[key])) {
444
+ options.named[key] = escapeHtml(options.named[key]);
445
+ }
446
+ });
447
+ }
448
+ }
449
+ function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
450
+ const { messages, onWarn } = context;
451
+ const locales = getLocaleChain(context, fallbackLocale, locale);
452
+ let message = {};
453
+ let targetLocale;
454
+ let format = null;
455
+ let from = locale;
456
+ let to = null;
457
+ const type = 'translate';
458
+ for (let i = 0; i < locales.length; i++) {
459
+ targetLocale = to = locales[i];
460
+ if ((process.env.NODE_ENV !== 'production') &&
461
+ locale !== targetLocale &&
462
+ isTranslateFallbackWarn(fallbackWarn, key)) {
463
+ onWarn(getWarnMessage(1 /* FALLBACK_TO_TRANSLATE */, {
464
+ key,
465
+ target: targetLocale
466
+ }));
467
+ }
468
+ // for vue-devtools timeline event
469
+ if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
470
+ const emitter = context.__v_emitter;
471
+ if (emitter) {
472
+ emitter.emit("fallback" /* FALBACK */, {
473
+ type,
474
+ key,
475
+ from,
476
+ to,
477
+ groupId: `${type}:${key}`
478
+ });
479
+ }
480
+ }
481
+ message =
482
+ messages[targetLocale] || {};
483
+ // for vue-devtools timeline event
484
+ let start = null;
485
+ let startTag;
486
+ let endTag;
487
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
488
+ start = window.performance.now();
489
+ startTag = 'intlify-message-resolve-start';
490
+ endTag = 'intlify-message-resolve-end';
491
+ mark && mark(startTag);
492
+ }
493
+ if ((format = resolveValue(message, key)) === null) {
494
+ // if null, resolve with object key path
495
+ format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
496
+ }
497
+ // for vue-devtools timeline event
498
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
499
+ const end = window.performance.now();
500
+ const emitter = context.__v_emitter;
501
+ if (emitter && start && format) {
502
+ emitter.emit("message-resolve" /* MESSAGE_RESOLVE */, {
503
+ type: "message-resolve" /* MESSAGE_RESOLVE */,
504
+ key,
505
+ message: format,
506
+ time: end - start,
507
+ groupId: `${type}:${key}`
508
+ });
509
+ }
510
+ if (startTag && endTag && mark && measure) {
511
+ mark(endTag);
512
+ measure('intlify message resolve', startTag, endTag);
513
+ }
514
+ }
515
+ if (isString(format) || isFunction(format))
516
+ break;
517
+ const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
518
+ if (missingRet !== key) {
519
+ format = missingRet;
520
+ }
521
+ from = to;
522
+ }
523
+ return [format, targetLocale, message];
524
+ }
525
+ function compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
526
+ const { messageCompiler, warnHtmlMessage } = context;
527
+ if (isMessageFunction(format)) {
528
+ const msg = format;
529
+ msg.locale = msg.locale || targetLocale;
530
+ msg.key = msg.key || key;
531
+ return msg;
532
+ }
533
+ // for vue-devtools timeline event
534
+ let start = null;
535
+ let startTag;
536
+ let endTag;
537
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
538
+ start = window.performance.now();
539
+ startTag = 'intlify-message-compilation-start';
540
+ endTag = 'intlify-message-compilation-end';
541
+ mark && mark(startTag);
542
+ }
543
+ const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
544
+ // for vue-devtools timeline event
545
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
546
+ const end = window.performance.now();
547
+ const emitter = context.__v_emitter;
548
+ if (emitter && start) {
549
+ emitter.emit("message-compilation" /* MESSAGE_COMPILATION */, {
550
+ type: "message-compilation" /* MESSAGE_COMPILATION */,
551
+ message: format,
552
+ time: end - start,
553
+ groupId: `${'translate'}:${key}`
554
+ });
555
+ }
556
+ if (startTag && endTag && mark && measure) {
557
+ mark(endTag);
558
+ measure('intlify message compilation', startTag, endTag);
559
+ }
560
+ }
561
+ msg.locale = targetLocale;
562
+ msg.key = key;
563
+ msg.source = format;
564
+ return msg;
565
+ }
566
+ function evaluateMessage(context, msg, msgCtx) {
567
+ // for vue-devtools timeline event
568
+ let start = null;
569
+ let startTag;
570
+ let endTag;
571
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
572
+ start = window.performance.now();
573
+ startTag = 'intlify-message-evaluation-start';
574
+ endTag = 'intlify-message-evaluation-end';
575
+ mark && mark(startTag);
576
+ }
577
+ const messaged = msg(msgCtx);
578
+ // for vue-devtools timeline event
579
+ if ((process.env.NODE_ENV !== 'production') && inBrowser) {
580
+ const end = window.performance.now();
581
+ const emitter = context.__v_emitter;
582
+ if (emitter && start) {
583
+ emitter.emit("message-evaluation" /* MESSAGE_EVALUATION */, {
584
+ type: "message-evaluation" /* MESSAGE_EVALUATION */,
585
+ value: messaged,
586
+ time: end - start,
587
+ groupId: `${'translate'}:${msg.key}`
588
+ });
589
+ }
590
+ if (startTag && endTag && mark && measure) {
591
+ mark(endTag);
592
+ measure('intlify message evaluation', startTag, endTag);
593
+ }
594
+ }
595
+ return messaged;
596
+ }
597
+ /** @internal */
598
+ function parseTranslateArgs(...args) {
599
+ const [arg1, arg2, arg3] = args;
600
+ const options = {};
601
+ if (!isString(arg1) && !isNumber(arg1) && !isMessageFunction(arg1)) {
602
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
603
+ }
604
+ // prettier-ignore
605
+ const key = isNumber(arg1)
606
+ ? String(arg1)
607
+ : isMessageFunction(arg1)
608
+ ? arg1
609
+ : arg1;
610
+ if (isNumber(arg2)) {
611
+ options.plural = arg2;
612
+ }
613
+ else if (isString(arg2)) {
614
+ options.default = arg2;
615
+ }
616
+ else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
617
+ options.named = arg2;
618
+ }
619
+ else if (isArray(arg2)) {
620
+ options.list = arg2;
621
+ }
622
+ if (isNumber(arg3)) {
623
+ options.plural = arg3;
624
+ }
625
+ else if (isString(arg3)) {
626
+ options.default = arg3;
627
+ }
628
+ else if (isPlainObject(arg3)) {
629
+ assign(options, arg3);
630
+ }
631
+ return [key, options];
632
+ }
633
+ function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
634
+ return {
635
+ warnHtmlMessage,
636
+ onError: (err) => {
637
+ errorDetector && errorDetector(err);
638
+ if ((process.env.NODE_ENV !== 'production')) {
639
+ const message = `Message compilation error: ${err.message}`;
640
+ const codeFrame = err.location &&
641
+ generateCodeFrame(source, err.location.start.offset, err.location.end.offset);
642
+ const emitter = context
643
+ .__v_emitter;
644
+ if (emitter) {
645
+ emitter.emit("compile-error" /* COMPILE_ERROR */, {
646
+ message: source,
647
+ error: err.message,
648
+ start: err.location && err.location.start.offset,
649
+ end: err.location && err.location.end.offset,
650
+ groupId: `${'translate'}:${key}`
651
+ });
652
+ }
653
+ console.error(codeFrame ? `${message}\n${codeFrame}` : message);
654
+ }
655
+ else {
656
+ throw err;
657
+ }
658
+ },
659
+ onCacheKey: (source) => generateFormatCacheKey(locale, key, source)
660
+ };
661
+ }
662
+ function getMessageContextOptions(context, locale, message, options) {
663
+ const { modifiers, pluralRules } = context;
664
+ const resolveMessage = (key) => {
665
+ const val = resolveValue(message, key);
666
+ if (isString(val)) {
667
+ let occurred = false;
668
+ const errorDetector = () => {
669
+ occurred = true;
670
+ };
671
+ const msg = compileMessageFormat(context, key, locale, val, key, errorDetector);
672
+ return !occurred
673
+ ? msg
674
+ : NOOP_MESSAGE_FUNCTION;
675
+ }
676
+ else if (isMessageFunction(val)) {
677
+ return val;
678
+ }
679
+ else {
680
+ // TODO: should be implemented warning message
681
+ return NOOP_MESSAGE_FUNCTION;
682
+ }
683
+ };
684
+ const ctxOptions = {
685
+ locale,
686
+ modifiers,
687
+ pluralRules,
688
+ messages: resolveMessage
689
+ };
690
+ if (context.processor) {
691
+ ctxOptions.processor = context.processor;
692
+ }
693
+ if (options.list) {
694
+ ctxOptions.list = options.list;
695
+ }
696
+ if (options.named) {
697
+ ctxOptions.named = options.named;
698
+ }
699
+ if (isNumber(options.plural)) {
700
+ ctxOptions.pluralIndex = options.plural;
701
+ }
702
+ return ctxOptions;
703
+ }
704
+
705
+ const intlDefined = typeof Intl !== 'undefined';
706
+ const Availabilities = {
707
+ dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
708
+ numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
709
+ };
710
+
711
+ // implementation of `datetime` function
712
+ function datetime(context, ...args) {
713
+ const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
714
+ const { __datetimeFormatters } = context;
715
+ if ((process.env.NODE_ENV !== 'production') && !Availabilities.dateTimeFormat) {
716
+ onWarn(getWarnMessage(4 /* CANNOT_FORMAT_DATE */));
717
+ return MISSING_RESOLVE_VALUE;
718
+ }
719
+ const [key, value, options, overrides] = parseDateTimeArgs(...args);
720
+ const missingWarn = isBoolean(options.missingWarn)
721
+ ? options.missingWarn
722
+ : context.missingWarn;
723
+ const fallbackWarn = isBoolean(options.fallbackWarn)
724
+ ? options.fallbackWarn
725
+ : context.fallbackWarn;
726
+ const part = !!options.part;
727
+ const locale = isString(options.locale) ? options.locale : context.locale;
728
+ const locales = getLocaleChain(context, fallbackLocale, locale);
729
+ if (!isString(key) || key === '') {
730
+ return new Intl.DateTimeFormat(locale).format(value);
731
+ }
732
+ // resolve format
733
+ let datetimeFormat = {};
734
+ let targetLocale;
735
+ let format = null;
736
+ let from = locale;
737
+ let to = null;
738
+ const type = 'datetime format';
739
+ for (let i = 0; i < locales.length; i++) {
740
+ targetLocale = to = locales[i];
741
+ if ((process.env.NODE_ENV !== 'production') &&
742
+ locale !== targetLocale &&
743
+ isTranslateFallbackWarn(fallbackWarn, key)) {
744
+ onWarn(getWarnMessage(5 /* FALLBACK_TO_DATE_FORMAT */, {
745
+ key,
746
+ target: targetLocale
747
+ }));
748
+ }
749
+ // for vue-devtools timeline event
750
+ if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
751
+ const emitter = context.__v_emitter;
752
+ if (emitter) {
753
+ emitter.emit("fallback" /* FALBACK */, {
754
+ type,
755
+ key,
756
+ from,
757
+ to,
758
+ groupId: `${type}:${key}`
759
+ });
760
+ }
761
+ }
762
+ datetimeFormat =
763
+ datetimeFormats[targetLocale] || {};
764
+ format = datetimeFormat[key];
765
+ if (isPlainObject(format))
766
+ break;
767
+ handleMissing(context, key, targetLocale, missingWarn, type);
768
+ from = to;
769
+ }
770
+ // checking format and target locale
771
+ if (!isPlainObject(format) || !isString(targetLocale)) {
772
+ return unresolving ? NOT_REOSLVED : key;
773
+ }
774
+ let id = `${targetLocale}__${key}`;
775
+ if (!isEmptyObject(overrides)) {
776
+ id = `${id}__${JSON.stringify(overrides)}`;
777
+ }
778
+ let formatter = __datetimeFormatters.get(id);
779
+ if (!formatter) {
780
+ formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format, overrides));
781
+ __datetimeFormatters.set(id, formatter);
782
+ }
783
+ return !part ? formatter.format(value) : formatter.formatToParts(value);
784
+ }
785
+ /** @internal */
786
+ function parseDateTimeArgs(...args) {
787
+ const [arg1, arg2, arg3, arg4] = args;
788
+ let options = {};
789
+ let overrides = {};
790
+ let value;
791
+ if (isString(arg1)) {
792
+ // Only allow ISO strings - other date formats are often supported,
793
+ // but may cause different results in different browsers.
794
+ if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
795
+ throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
796
+ }
797
+ value = new Date(arg1);
798
+ try {
799
+ // This will fail if the date is not valid
800
+ value.toISOString();
801
+ }
802
+ catch (e) {
803
+ throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
804
+ }
805
+ }
806
+ else if (isDate(arg1)) {
807
+ if (isNaN(arg1.getTime())) {
808
+ throw createCoreError(15 /* INVALID_DATE_ARGUMENT */);
809
+ }
810
+ value = arg1;
811
+ }
812
+ else if (isNumber(arg1)) {
813
+ value = arg1;
814
+ }
815
+ else {
816
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
817
+ }
818
+ if (isString(arg2)) {
819
+ options.key = arg2;
820
+ }
821
+ else if (isPlainObject(arg2)) {
822
+ options = arg2;
823
+ }
824
+ if (isString(arg3)) {
825
+ options.locale = arg3;
826
+ }
827
+ else if (isPlainObject(arg3)) {
828
+ overrides = arg3;
829
+ }
830
+ if (isPlainObject(arg4)) {
831
+ overrides = arg4;
832
+ }
833
+ return [options.key || '', value, options, overrides];
834
+ }
835
+ /** @internal */
836
+ function clearDateTimeFormat(ctx, locale, format) {
837
+ const context = ctx;
838
+ for (const key in format) {
839
+ const id = `${locale}__${key}`;
840
+ if (!context.__datetimeFormatters.has(id)) {
841
+ continue;
842
+ }
843
+ context.__datetimeFormatters.delete(id);
844
+ }
845
+ }
846
+
847
+ // implementation of `number` function
848
+ function number(context, ...args) {
849
+ const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
850
+ const { __numberFormatters } = context;
851
+ if ((process.env.NODE_ENV !== 'production') && !Availabilities.numberFormat) {
852
+ onWarn(getWarnMessage(2 /* CANNOT_FORMAT_NUMBER */));
853
+ return MISSING_RESOLVE_VALUE;
854
+ }
855
+ const [key, value, options, overrides] = parseNumberArgs(...args);
856
+ const missingWarn = isBoolean(options.missingWarn)
857
+ ? options.missingWarn
858
+ : context.missingWarn;
859
+ const fallbackWarn = isBoolean(options.fallbackWarn)
860
+ ? options.fallbackWarn
861
+ : context.fallbackWarn;
862
+ const part = !!options.part;
863
+ const locale = isString(options.locale) ? options.locale : context.locale;
864
+ const locales = getLocaleChain(context, fallbackLocale, locale);
865
+ if (!isString(key) || key === '') {
866
+ return new Intl.NumberFormat(locale).format(value);
867
+ }
868
+ // resolve format
869
+ let numberFormat = {};
870
+ let targetLocale;
871
+ let format = null;
872
+ let from = locale;
873
+ let to = null;
874
+ const type = 'number format';
875
+ for (let i = 0; i < locales.length; i++) {
876
+ targetLocale = to = locales[i];
877
+ if ((process.env.NODE_ENV !== 'production') &&
878
+ locale !== targetLocale &&
879
+ isTranslateFallbackWarn(fallbackWarn, key)) {
880
+ onWarn(getWarnMessage(3 /* FALLBACK_TO_NUMBER_FORMAT */, {
881
+ key,
882
+ target: targetLocale
883
+ }));
884
+ }
885
+ // for vue-devtools timeline event
886
+ if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {
887
+ const emitter = context.__v_emitter;
888
+ if (emitter) {
889
+ emitter.emit("fallback" /* FALBACK */, {
890
+ type,
891
+ key,
892
+ from,
893
+ to,
894
+ groupId: `${type}:${key}`
895
+ });
896
+ }
897
+ }
898
+ numberFormat =
899
+ numberFormats[targetLocale] || {};
900
+ format = numberFormat[key];
901
+ if (isPlainObject(format))
902
+ break;
903
+ handleMissing(context, key, targetLocale, missingWarn, type);
904
+ from = to;
905
+ }
906
+ // checking format and target locale
907
+ if (!isPlainObject(format) || !isString(targetLocale)) {
908
+ return unresolving ? NOT_REOSLVED : key;
909
+ }
910
+ let id = `${targetLocale}__${key}`;
911
+ if (!isEmptyObject(overrides)) {
912
+ id = `${id}__${JSON.stringify(overrides)}`;
913
+ }
914
+ let formatter = __numberFormatters.get(id);
915
+ if (!formatter) {
916
+ formatter = new Intl.NumberFormat(targetLocale, assign({}, format, overrides));
917
+ __numberFormatters.set(id, formatter);
918
+ }
919
+ return !part ? formatter.format(value) : formatter.formatToParts(value);
920
+ }
921
+ /** @internal */
922
+ function parseNumberArgs(...args) {
923
+ const [arg1, arg2, arg3, arg4] = args;
924
+ let options = {};
925
+ let overrides = {};
926
+ if (!isNumber(arg1)) {
927
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
928
+ }
929
+ const value = arg1;
930
+ if (isString(arg2)) {
931
+ options.key = arg2;
932
+ }
933
+ else if (isPlainObject(arg2)) {
934
+ options = arg2;
935
+ }
936
+ if (isString(arg3)) {
937
+ options.locale = arg3;
938
+ }
939
+ else if (isPlainObject(arg3)) {
940
+ overrides = arg3;
941
+ }
942
+ if (isPlainObject(arg4)) {
943
+ overrides = arg4;
944
+ }
945
+ return [options.key || '', value, options, overrides];
946
+ }
947
+ /** @internal */
948
+ function clearNumberFormat(ctx, locale, format) {
949
+ const context = ctx;
950
+ for (const key in format) {
951
+ const id = `${locale}__${key}`;
952
+ if (!context.__numberFormatters.has(id)) {
953
+ continue;
954
+ }
955
+ context.__numberFormatters.delete(id);
956
+ }
957
+ }
958
+
959
+ {
960
+ if (typeof __INTLIFY_PROD_DEVTOOLS__ !== 'boolean') {
961
+ getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;
962
+ }
963
+ }
964
+
965
+ export { MISSING_RESOLVE_VALUE, NOT_REOSLVED, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compileToFunction, createCoreContext, createCoreError, datetime, getAdditionalMeta, getDevToolsHook, getLocaleChain, getWarnMessage, handleMissing, initI18nDevTools, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerMessageCompiler, setAdditionalMeta, setDevToolsHook, translate, translateDevTools, updateFallbackLocale };