@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,735 @@
1
+ /*!
2
+ * @intlify/core-base v9.1.7
3
+ * (c) 2021 kazuya kawaguchi
4
+ * Released under the MIT License.
5
+ */
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var messageResolver = require('@intlify/message-resolver');
11
+ var runtime = require('@intlify/runtime');
12
+ var messageCompiler = require('@intlify/message-compiler');
13
+ var shared = require('@intlify/shared');
14
+ var devtoolsIf = require('@intlify/devtools-if');
15
+
16
+ let devtools = null;
17
+ function setDevToolsHook(hook) {
18
+ devtools = hook;
19
+ }
20
+ function getDevToolsHook() {
21
+ return devtools;
22
+ }
23
+ function initI18nDevTools(i18n, version, meta) {
24
+ // TODO: queue if devtools is undefined
25
+ devtools &&
26
+ devtools.emit(devtoolsIf.IntlifyDevToolsHooks.I18nInit, {
27
+ timestamp: Date.now(),
28
+ i18n,
29
+ version,
30
+ meta
31
+ });
32
+ }
33
+ const translateDevTools = /* #__PURE__*/ createDevToolsHook(devtoolsIf.IntlifyDevToolsHooks.FunctionTranslate);
34
+ function createDevToolsHook(hook) {
35
+ return (payloads) => devtools && devtools.emit(hook, payloads);
36
+ }
37
+
38
+ /** @internal */
39
+ const warnMessages = {
40
+ [0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
41
+ [1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
42
+ [2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
43
+ [3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
44
+ [4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
45
+ [5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
46
+ };
47
+ function getWarnMessage(code, ...args) {
48
+ return shared.format(warnMessages[code], ...args);
49
+ }
50
+
51
+ /**
52
+ * Intlify core-base version
53
+ * @internal
54
+ */
55
+ const VERSION = '9.1.7';
56
+ const NOT_REOSLVED = -1;
57
+ const MISSING_RESOLVE_VALUE = '';
58
+ function getDefaultLinkedModifiers() {
59
+ return {
60
+ upper: (val) => (shared.isString(val) ? val.toUpperCase() : val),
61
+ lower: (val) => (shared.isString(val) ? val.toLowerCase() : val),
62
+ // prettier-ignore
63
+ capitalize: (val) => (shared.isString(val)
64
+ ? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
65
+ : val)
66
+ };
67
+ }
68
+ let _compiler;
69
+ function registerMessageCompiler(compiler) {
70
+ _compiler = compiler;
71
+ }
72
+ // Additional Meta for Intlify DevTools
73
+ let _additionalMeta = null;
74
+ const setAdditionalMeta = /* #__PURE__*/ (meta) => {
75
+ _additionalMeta = meta;
76
+ };
77
+ const getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;
78
+ // ID for CoreContext
79
+ let _cid = 0;
80
+ function createCoreContext(options = {}) {
81
+ // setup options
82
+ const version = shared.isString(options.version) ? options.version : VERSION;
83
+ const locale = shared.isString(options.locale) ? options.locale : 'en-US';
84
+ const fallbackLocale = shared.isArray(options.fallbackLocale) ||
85
+ shared.isPlainObject(options.fallbackLocale) ||
86
+ shared.isString(options.fallbackLocale) ||
87
+ options.fallbackLocale === false
88
+ ? options.fallbackLocale
89
+ : locale;
90
+ const messages = shared.isPlainObject(options.messages)
91
+ ? options.messages
92
+ : { [locale]: {} };
93
+ const datetimeFormats = shared.isPlainObject(options.datetimeFormats)
94
+ ? options.datetimeFormats
95
+ : { [locale]: {} };
96
+ const numberFormats = shared.isPlainObject(options.numberFormats)
97
+ ? options.numberFormats
98
+ : { [locale]: {} };
99
+ const modifiers = shared.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
100
+ const pluralRules = options.pluralRules || {};
101
+ const missing = shared.isFunction(options.missing) ? options.missing : null;
102
+ const missingWarn = shared.isBoolean(options.missingWarn) || shared.isRegExp(options.missingWarn)
103
+ ? options.missingWarn
104
+ : true;
105
+ const fallbackWarn = shared.isBoolean(options.fallbackWarn) || shared.isRegExp(options.fallbackWarn)
106
+ ? options.fallbackWarn
107
+ : true;
108
+ const fallbackFormat = !!options.fallbackFormat;
109
+ const unresolving = !!options.unresolving;
110
+ const postTranslation = shared.isFunction(options.postTranslation)
111
+ ? options.postTranslation
112
+ : null;
113
+ const processor = shared.isPlainObject(options.processor) ? options.processor : null;
114
+ const warnHtmlMessage = shared.isBoolean(options.warnHtmlMessage)
115
+ ? options.warnHtmlMessage
116
+ : true;
117
+ const escapeParameter = !!options.escapeParameter;
118
+ const messageCompiler = shared.isFunction(options.messageCompiler)
119
+ ? options.messageCompiler
120
+ : _compiler;
121
+ const onWarn = shared.isFunction(options.onWarn) ? options.onWarn : shared.warn;
122
+ // setup internal options
123
+ const internalOptions = options;
124
+ const __datetimeFormatters = shared.isObject(internalOptions.__datetimeFormatters)
125
+ ? internalOptions.__datetimeFormatters
126
+ : new Map();
127
+ const __numberFormatters = shared.isObject(internalOptions.__numberFormatters)
128
+ ? internalOptions.__numberFormatters
129
+ : new Map();
130
+ const __meta = shared.isObject(internalOptions.__meta) ? internalOptions.__meta : {};
131
+ _cid++;
132
+ const context = {
133
+ version,
134
+ cid: _cid,
135
+ locale,
136
+ fallbackLocale,
137
+ messages,
138
+ datetimeFormats,
139
+ numberFormats,
140
+ modifiers,
141
+ pluralRules,
142
+ missing,
143
+ missingWarn,
144
+ fallbackWarn,
145
+ fallbackFormat,
146
+ unresolving,
147
+ postTranslation,
148
+ processor,
149
+ warnHtmlMessage,
150
+ escapeParameter,
151
+ messageCompiler,
152
+ onWarn,
153
+ __datetimeFormatters,
154
+ __numberFormatters,
155
+ __meta
156
+ };
157
+ return context;
158
+ }
159
+ /** @internal */
160
+ function isTranslateFallbackWarn(fallback, key) {
161
+ return fallback instanceof RegExp ? fallback.test(key) : fallback;
162
+ }
163
+ /** @internal */
164
+ function isTranslateMissingWarn(missing, key) {
165
+ return missing instanceof RegExp ? missing.test(key) : missing;
166
+ }
167
+ /** @internal */
168
+ function handleMissing(context, key, locale, missingWarn, type) {
169
+ const { missing, onWarn } = context;
170
+ if (missing !== null) {
171
+ const ret = missing(context, locale, key, type);
172
+ return shared.isString(ret) ? ret : key;
173
+ }
174
+ else {
175
+ return key;
176
+ }
177
+ }
178
+ /** @internal */
179
+ function getLocaleChain(ctx, fallback, start) {
180
+ const context = ctx;
181
+ if (!context.__localeChainCache) {
182
+ context.__localeChainCache = new Map();
183
+ }
184
+ let chain = context.__localeChainCache.get(start);
185
+ if (!chain) {
186
+ chain = [];
187
+ // first block defined by start
188
+ let block = [start];
189
+ // while any intervening block found
190
+ while (shared.isArray(block)) {
191
+ block = appendBlockToChain(chain, block, fallback);
192
+ }
193
+ // prettier-ignore
194
+ // last block defined by default
195
+ const defaults = shared.isArray(fallback)
196
+ ? fallback
197
+ : shared.isPlainObject(fallback)
198
+ ? fallback['default']
199
+ ? fallback['default']
200
+ : null
201
+ : fallback;
202
+ // convert defaults to array
203
+ block = shared.isString(defaults) ? [defaults] : defaults;
204
+ if (shared.isArray(block)) {
205
+ appendBlockToChain(chain, block, false);
206
+ }
207
+ context.__localeChainCache.set(start, chain);
208
+ }
209
+ return chain;
210
+ }
211
+ function appendBlockToChain(chain, block, blocks) {
212
+ let follow = true;
213
+ for (let i = 0; i < block.length && shared.isBoolean(follow); i++) {
214
+ const locale = block[i];
215
+ if (shared.isString(locale)) {
216
+ follow = appendLocaleToChain(chain, block[i], blocks);
217
+ }
218
+ }
219
+ return follow;
220
+ }
221
+ function appendLocaleToChain(chain, locale, blocks) {
222
+ let follow;
223
+ const tokens = locale.split('-');
224
+ do {
225
+ const target = tokens.join('-');
226
+ follow = appendItemToChain(chain, target, blocks);
227
+ tokens.splice(-1, 1);
228
+ } while (tokens.length && follow === true);
229
+ return follow;
230
+ }
231
+ function appendItemToChain(chain, target, blocks) {
232
+ let follow = false;
233
+ if (!chain.includes(target)) {
234
+ follow = true;
235
+ if (target) {
236
+ follow = target[target.length - 1] !== '!';
237
+ const locale = target.replace(/!/g, '');
238
+ chain.push(locale);
239
+ if ((shared.isArray(blocks) || shared.isPlainObject(blocks)) &&
240
+ blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
241
+ ) {
242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
+ follow = blocks[locale];
244
+ }
245
+ }
246
+ }
247
+ return follow;
248
+ }
249
+ /** @internal */
250
+ function updateFallbackLocale(ctx, locale, fallback) {
251
+ const context = ctx;
252
+ context.__localeChainCache = new Map();
253
+ getLocaleChain(ctx, fallback, locale);
254
+ }
255
+
256
+ const defaultOnCacheKey = (source) => source;
257
+ let compileCache = Object.create(null);
258
+ function clearCompileCache() {
259
+ compileCache = Object.create(null);
260
+ }
261
+ function compileToFunction(source, options = {}) {
262
+ {
263
+ // check caches
264
+ const onCacheKey = options.onCacheKey || defaultOnCacheKey;
265
+ const key = onCacheKey(source);
266
+ const cached = compileCache[key];
267
+ if (cached) {
268
+ return cached;
269
+ }
270
+ // compile error detecting
271
+ let occurred = false;
272
+ const onError = options.onError || messageCompiler.defaultOnError;
273
+ options.onError = (err) => {
274
+ occurred = true;
275
+ onError(err);
276
+ };
277
+ // compile
278
+ const { code } = messageCompiler.baseCompile(source, options);
279
+ // evaluate function
280
+ const msg = new Function(`return ${code}`)();
281
+ // if occurred compile error, don't cache
282
+ return !occurred ? (compileCache[key] = msg) : msg;
283
+ }
284
+ }
285
+
286
+ function createCoreError(code) {
287
+ return messageCompiler.createCompileError(code, null, undefined);
288
+ }
289
+
290
+ const NOOP_MESSAGE_FUNCTION = () => '';
291
+ const isMessageFunction = (val) => shared.isFunction(val);
292
+ // implementation of `translate` function
293
+ function translate(context, ...args) {
294
+ const { fallbackFormat, postTranslation, unresolving, fallbackLocale, messages } = context;
295
+ const [key, options] = parseTranslateArgs(...args);
296
+ const missingWarn = shared.isBoolean(options.missingWarn)
297
+ ? options.missingWarn
298
+ : context.missingWarn;
299
+ const fallbackWarn = shared.isBoolean(options.fallbackWarn)
300
+ ? options.fallbackWarn
301
+ : context.fallbackWarn;
302
+ const escapeParameter = shared.isBoolean(options.escapeParameter)
303
+ ? options.escapeParameter
304
+ : context.escapeParameter;
305
+ const resolvedMessage = !!options.resolvedMessage;
306
+ // prettier-ignore
307
+ const defaultMsgOrKey = shared.isString(options.default) || shared.isBoolean(options.default) // default by function option
308
+ ? !shared.isBoolean(options.default)
309
+ ? options.default
310
+ : key
311
+ : fallbackFormat // default by `fallbackFormat` option
312
+ ? key
313
+ : '';
314
+ const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
315
+ const locale = shared.isString(options.locale) ? options.locale : context.locale;
316
+ // escape params
317
+ escapeParameter && escapeParams(options);
318
+ // resolve message format
319
+ // eslint-disable-next-line prefer-const
320
+ let [format, targetLocale, message] = !resolvedMessage
321
+ ? resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn)
322
+ : [
323
+ key,
324
+ locale,
325
+ messages[locale] || {}
326
+ ];
327
+ // if you use default message, set it as message format!
328
+ let cacheBaseKey = key;
329
+ if (!resolvedMessage &&
330
+ !(shared.isString(format) || isMessageFunction(format))) {
331
+ if (enableDefaultMsg) {
332
+ format = defaultMsgOrKey;
333
+ cacheBaseKey = format;
334
+ }
335
+ }
336
+ // checking message format and target locale
337
+ if (!resolvedMessage &&
338
+ (!(shared.isString(format) || isMessageFunction(format)) ||
339
+ !shared.isString(targetLocale))) {
340
+ return unresolving ? NOT_REOSLVED : key;
341
+ }
342
+ // setup compile error detecting
343
+ let occurred = false;
344
+ const errorDetector = () => {
345
+ occurred = true;
346
+ };
347
+ // compile message format
348
+ const msg = !isMessageFunction(format)
349
+ ? compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector)
350
+ : format;
351
+ // if occurred compile error, return the message format
352
+ if (occurred) {
353
+ return format;
354
+ }
355
+ // evaluate message with context
356
+ const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
357
+ const msgContext = runtime.createMessageContext(ctxOptions);
358
+ const messaged = evaluateMessage(context, msg, msgContext);
359
+ // if use post translation option, proceed it with handler
360
+ const ret = postTranslation ? postTranslation(messaged) : messaged;
361
+ return ret;
362
+ }
363
+ function escapeParams(options) {
364
+ if (shared.isArray(options.list)) {
365
+ options.list = options.list.map(item => shared.isString(item) ? shared.escapeHtml(item) : item);
366
+ }
367
+ else if (shared.isObject(options.named)) {
368
+ Object.keys(options.named).forEach(key => {
369
+ if (shared.isString(options.named[key])) {
370
+ options.named[key] = shared.escapeHtml(options.named[key]);
371
+ }
372
+ });
373
+ }
374
+ }
375
+ function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
376
+ const { messages, onWarn } = context;
377
+ const locales = getLocaleChain(context, fallbackLocale, locale);
378
+ let message = {};
379
+ let targetLocale;
380
+ let format = null;
381
+ const type = 'translate';
382
+ for (let i = 0; i < locales.length; i++) {
383
+ targetLocale = locales[i];
384
+ message =
385
+ messages[targetLocale] || {};
386
+ if ((format = messageResolver.resolveValue(message, key)) === null) {
387
+ // if null, resolve with object key path
388
+ format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
389
+ }
390
+ if (shared.isString(format) || shared.isFunction(format))
391
+ break;
392
+ const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
393
+ if (missingRet !== key) {
394
+ format = missingRet;
395
+ }
396
+ }
397
+ return [format, targetLocale, message];
398
+ }
399
+ function compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
400
+ const { messageCompiler, warnHtmlMessage } = context;
401
+ if (isMessageFunction(format)) {
402
+ const msg = format;
403
+ msg.locale = msg.locale || targetLocale;
404
+ msg.key = msg.key || key;
405
+ return msg;
406
+ }
407
+ const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
408
+ msg.locale = targetLocale;
409
+ msg.key = key;
410
+ msg.source = format;
411
+ return msg;
412
+ }
413
+ function evaluateMessage(context, msg, msgCtx) {
414
+ const messaged = msg(msgCtx);
415
+ return messaged;
416
+ }
417
+ /** @internal */
418
+ function parseTranslateArgs(...args) {
419
+ const [arg1, arg2, arg3] = args;
420
+ const options = {};
421
+ if (!shared.isString(arg1) && !shared.isNumber(arg1) && !isMessageFunction(arg1)) {
422
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
423
+ }
424
+ // prettier-ignore
425
+ const key = shared.isNumber(arg1)
426
+ ? String(arg1)
427
+ : isMessageFunction(arg1)
428
+ ? arg1
429
+ : arg1;
430
+ if (shared.isNumber(arg2)) {
431
+ options.plural = arg2;
432
+ }
433
+ else if (shared.isString(arg2)) {
434
+ options.default = arg2;
435
+ }
436
+ else if (shared.isPlainObject(arg2) && !shared.isEmptyObject(arg2)) {
437
+ options.named = arg2;
438
+ }
439
+ else if (shared.isArray(arg2)) {
440
+ options.list = arg2;
441
+ }
442
+ if (shared.isNumber(arg3)) {
443
+ options.plural = arg3;
444
+ }
445
+ else if (shared.isString(arg3)) {
446
+ options.default = arg3;
447
+ }
448
+ else if (shared.isPlainObject(arg3)) {
449
+ shared.assign(options, arg3);
450
+ }
451
+ return [key, options];
452
+ }
453
+ function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
454
+ return {
455
+ warnHtmlMessage,
456
+ onError: (err) => {
457
+ errorDetector && errorDetector(err);
458
+ {
459
+ throw err;
460
+ }
461
+ },
462
+ onCacheKey: (source) => shared.generateFormatCacheKey(locale, key, source)
463
+ };
464
+ }
465
+ function getMessageContextOptions(context, locale, message, options) {
466
+ const { modifiers, pluralRules } = context;
467
+ const resolveMessage = (key) => {
468
+ const val = messageResolver.resolveValue(message, key);
469
+ if (shared.isString(val)) {
470
+ let occurred = false;
471
+ const errorDetector = () => {
472
+ occurred = true;
473
+ };
474
+ const msg = compileMessageFormat(context, key, locale, val, key, errorDetector);
475
+ return !occurred
476
+ ? msg
477
+ : NOOP_MESSAGE_FUNCTION;
478
+ }
479
+ else if (isMessageFunction(val)) {
480
+ return val;
481
+ }
482
+ else {
483
+ // TODO: should be implemented warning message
484
+ return NOOP_MESSAGE_FUNCTION;
485
+ }
486
+ };
487
+ const ctxOptions = {
488
+ locale,
489
+ modifiers,
490
+ pluralRules,
491
+ messages: resolveMessage
492
+ };
493
+ if (context.processor) {
494
+ ctxOptions.processor = context.processor;
495
+ }
496
+ if (options.list) {
497
+ ctxOptions.list = options.list;
498
+ }
499
+ if (options.named) {
500
+ ctxOptions.named = options.named;
501
+ }
502
+ if (shared.isNumber(options.plural)) {
503
+ ctxOptions.pluralIndex = options.plural;
504
+ }
505
+ return ctxOptions;
506
+ }
507
+
508
+ // implementation of `datetime` function
509
+ function datetime(context, ...args) {
510
+ const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
511
+ const { __datetimeFormatters } = context;
512
+ const [key, value, options, overrides] = parseDateTimeArgs(...args);
513
+ const missingWarn = shared.isBoolean(options.missingWarn)
514
+ ? options.missingWarn
515
+ : context.missingWarn;
516
+ shared.isBoolean(options.fallbackWarn)
517
+ ? options.fallbackWarn
518
+ : context.fallbackWarn;
519
+ const part = !!options.part;
520
+ const locale = shared.isString(options.locale) ? options.locale : context.locale;
521
+ const locales = getLocaleChain(context, fallbackLocale, locale);
522
+ if (!shared.isString(key) || key === '') {
523
+ return new Intl.DateTimeFormat(locale).format(value);
524
+ }
525
+ // resolve format
526
+ let datetimeFormat = {};
527
+ let targetLocale;
528
+ let format = null;
529
+ const type = 'datetime format';
530
+ for (let i = 0; i < locales.length; i++) {
531
+ targetLocale = locales[i];
532
+ datetimeFormat =
533
+ datetimeFormats[targetLocale] || {};
534
+ format = datetimeFormat[key];
535
+ if (shared.isPlainObject(format))
536
+ break;
537
+ handleMissing(context, key, targetLocale, missingWarn, type);
538
+ }
539
+ // checking format and target locale
540
+ if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
541
+ return unresolving ? NOT_REOSLVED : key;
542
+ }
543
+ let id = `${targetLocale}__${key}`;
544
+ if (!shared.isEmptyObject(overrides)) {
545
+ id = `${id}__${JSON.stringify(overrides)}`;
546
+ }
547
+ let formatter = __datetimeFormatters.get(id);
548
+ if (!formatter) {
549
+ formatter = new Intl.DateTimeFormat(targetLocale, shared.assign({}, format, overrides));
550
+ __datetimeFormatters.set(id, formatter);
551
+ }
552
+ return !part ? formatter.format(value) : formatter.formatToParts(value);
553
+ }
554
+ /** @internal */
555
+ function parseDateTimeArgs(...args) {
556
+ const [arg1, arg2, arg3, arg4] = args;
557
+ let options = {};
558
+ let overrides = {};
559
+ let value;
560
+ if (shared.isString(arg1)) {
561
+ // Only allow ISO strings - other date formats are often supported,
562
+ // but may cause different results in different browsers.
563
+ if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
564
+ throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
565
+ }
566
+ value = new Date(arg1);
567
+ try {
568
+ // This will fail if the date is not valid
569
+ value.toISOString();
570
+ }
571
+ catch (e) {
572
+ throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
573
+ }
574
+ }
575
+ else if (shared.isDate(arg1)) {
576
+ if (isNaN(arg1.getTime())) {
577
+ throw createCoreError(15 /* INVALID_DATE_ARGUMENT */);
578
+ }
579
+ value = arg1;
580
+ }
581
+ else if (shared.isNumber(arg1)) {
582
+ value = arg1;
583
+ }
584
+ else {
585
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
586
+ }
587
+ if (shared.isString(arg2)) {
588
+ options.key = arg2;
589
+ }
590
+ else if (shared.isPlainObject(arg2)) {
591
+ options = arg2;
592
+ }
593
+ if (shared.isString(arg3)) {
594
+ options.locale = arg3;
595
+ }
596
+ else if (shared.isPlainObject(arg3)) {
597
+ overrides = arg3;
598
+ }
599
+ if (shared.isPlainObject(arg4)) {
600
+ overrides = arg4;
601
+ }
602
+ return [options.key || '', value, options, overrides];
603
+ }
604
+ /** @internal */
605
+ function clearDateTimeFormat(ctx, locale, format) {
606
+ const context = ctx;
607
+ for (const key in format) {
608
+ const id = `${locale}__${key}`;
609
+ if (!context.__datetimeFormatters.has(id)) {
610
+ continue;
611
+ }
612
+ context.__datetimeFormatters.delete(id);
613
+ }
614
+ }
615
+
616
+ // implementation of `number` function
617
+ function number(context, ...args) {
618
+ const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
619
+ const { __numberFormatters } = context;
620
+ const [key, value, options, overrides] = parseNumberArgs(...args);
621
+ const missingWarn = shared.isBoolean(options.missingWarn)
622
+ ? options.missingWarn
623
+ : context.missingWarn;
624
+ shared.isBoolean(options.fallbackWarn)
625
+ ? options.fallbackWarn
626
+ : context.fallbackWarn;
627
+ const part = !!options.part;
628
+ const locale = shared.isString(options.locale) ? options.locale : context.locale;
629
+ const locales = getLocaleChain(context, fallbackLocale, locale);
630
+ if (!shared.isString(key) || key === '') {
631
+ return new Intl.NumberFormat(locale).format(value);
632
+ }
633
+ // resolve format
634
+ let numberFormat = {};
635
+ let targetLocale;
636
+ let format = null;
637
+ const type = 'number format';
638
+ for (let i = 0; i < locales.length; i++) {
639
+ targetLocale = locales[i];
640
+ numberFormat =
641
+ numberFormats[targetLocale] || {};
642
+ format = numberFormat[key];
643
+ if (shared.isPlainObject(format))
644
+ break;
645
+ handleMissing(context, key, targetLocale, missingWarn, type);
646
+ }
647
+ // checking format and target locale
648
+ if (!shared.isPlainObject(format) || !shared.isString(targetLocale)) {
649
+ return unresolving ? NOT_REOSLVED : key;
650
+ }
651
+ let id = `${targetLocale}__${key}`;
652
+ if (!shared.isEmptyObject(overrides)) {
653
+ id = `${id}__${JSON.stringify(overrides)}`;
654
+ }
655
+ let formatter = __numberFormatters.get(id);
656
+ if (!formatter) {
657
+ formatter = new Intl.NumberFormat(targetLocale, shared.assign({}, format, overrides));
658
+ __numberFormatters.set(id, formatter);
659
+ }
660
+ return !part ? formatter.format(value) : formatter.formatToParts(value);
661
+ }
662
+ /** @internal */
663
+ function parseNumberArgs(...args) {
664
+ const [arg1, arg2, arg3, arg4] = args;
665
+ let options = {};
666
+ let overrides = {};
667
+ if (!shared.isNumber(arg1)) {
668
+ throw createCoreError(14 /* INVALID_ARGUMENT */);
669
+ }
670
+ const value = arg1;
671
+ if (shared.isString(arg2)) {
672
+ options.key = arg2;
673
+ }
674
+ else if (shared.isPlainObject(arg2)) {
675
+ options = arg2;
676
+ }
677
+ if (shared.isString(arg3)) {
678
+ options.locale = arg3;
679
+ }
680
+ else if (shared.isPlainObject(arg3)) {
681
+ overrides = arg3;
682
+ }
683
+ if (shared.isPlainObject(arg4)) {
684
+ overrides = arg4;
685
+ }
686
+ return [options.key || '', value, options, overrides];
687
+ }
688
+ /** @internal */
689
+ function clearNumberFormat(ctx, locale, format) {
690
+ const context = ctx;
691
+ for (const key in format) {
692
+ const id = `${locale}__${key}`;
693
+ if (!context.__numberFormatters.has(id)) {
694
+ continue;
695
+ }
696
+ context.__numberFormatters.delete(id);
697
+ }
698
+ }
699
+
700
+ exports.createCompileError = messageCompiler.createCompileError;
701
+ exports.MISSING_RESOLVE_VALUE = MISSING_RESOLVE_VALUE;
702
+ exports.NOT_REOSLVED = NOT_REOSLVED;
703
+ exports.VERSION = VERSION;
704
+ exports.clearCompileCache = clearCompileCache;
705
+ exports.clearDateTimeFormat = clearDateTimeFormat;
706
+ exports.clearNumberFormat = clearNumberFormat;
707
+ exports.compileToFunction = compileToFunction;
708
+ exports.createCoreContext = createCoreContext;
709
+ exports.createCoreError = createCoreError;
710
+ exports.datetime = datetime;
711
+ exports.getAdditionalMeta = getAdditionalMeta;
712
+ exports.getDevToolsHook = getDevToolsHook;
713
+ exports.getLocaleChain = getLocaleChain;
714
+ exports.getWarnMessage = getWarnMessage;
715
+ exports.handleMissing = handleMissing;
716
+ exports.initI18nDevTools = initI18nDevTools;
717
+ exports.isMessageFunction = isMessageFunction;
718
+ exports.isTranslateFallbackWarn = isTranslateFallbackWarn;
719
+ exports.isTranslateMissingWarn = isTranslateMissingWarn;
720
+ exports.number = number;
721
+ exports.parseDateTimeArgs = parseDateTimeArgs;
722
+ exports.parseNumberArgs = parseNumberArgs;
723
+ exports.parseTranslateArgs = parseTranslateArgs;
724
+ exports.registerMessageCompiler = registerMessageCompiler;
725
+ exports.setAdditionalMeta = setAdditionalMeta;
726
+ exports.setDevToolsHook = setDevToolsHook;
727
+ exports.translate = translate;
728
+ exports.translateDevTools = translateDevTools;
729
+ exports.updateFallbackLocale = updateFallbackLocale;
730
+ Object.keys(messageResolver).forEach(function (k) {
731
+ if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = messageResolver[k];
732
+ });
733
+ Object.keys(runtime).forEach(function (k) {
734
+ if (k !== 'default' && !exports.hasOwnProperty(k)) exports[k] = runtime[k];
735
+ });