@mpxjs/webpack-plugin 2.10.15 → 2.10.16-beta.10

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 (274) hide show
  1. package/lib/config.js +60 -0
  2. package/lib/dependencies/AppEntryDependency.js +2 -2
  3. package/lib/dependencies/DynamicEntryDependency.js +1 -1
  4. package/lib/dependencies/ImportDependency.js +102 -0
  5. package/lib/dependencies/RecordModuleIdMapDependency.js +49 -0
  6. package/lib/dependencies/ResolveDependency.js +1 -1
  7. package/lib/{retry-runtime-module.js → dependencies/RetryRuntimeModule.js} +1 -1
  8. package/lib/file-loader.js +13 -3
  9. package/lib/helpers.js +2 -0
  10. package/lib/index.js +51 -25
  11. package/lib/json-compiler/helper.js +72 -2
  12. package/lib/json-compiler/index.js +16 -56
  13. package/lib/json-compiler/plugin.js +2 -2
  14. package/lib/loader.js +10 -4
  15. package/lib/native-loader.js +6 -3
  16. package/lib/platform/json/wx/index.js +30 -29
  17. package/lib/platform/style/wx/index.js +8 -1
  18. package/lib/platform/template/wx/component-config/ad.js +5 -0
  19. package/lib/platform/template/wx/component-config/button.js +21 -5
  20. package/lib/platform/template/wx/component-config/camera.js +25 -3
  21. package/lib/platform/template/wx/component-config/canvas.js +8 -1
  22. package/lib/platform/template/wx/component-config/component.js +31 -33
  23. package/lib/platform/template/wx/component-config/cover-image.js +7 -2
  24. package/lib/platform/template/wx/component-config/cover-view.js +3 -1
  25. package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
  26. package/lib/platform/template/wx/component-config/form.js +27 -2
  27. package/lib/platform/template/wx/component-config/image.js +5 -0
  28. package/lib/platform/template/wx/component-config/input.js +10 -0
  29. package/lib/platform/template/wx/component-config/label.js +10 -2
  30. package/lib/platform/template/wx/component-config/map.js +11 -0
  31. package/lib/platform/template/wx/component-config/movable-area.js +4 -1
  32. package/lib/platform/template/wx/component-config/movable-view.js +17 -2
  33. package/lib/platform/template/wx/component-config/navigator.js +26 -0
  34. package/lib/platform/template/wx/component-config/picker-view.js +12 -0
  35. package/lib/platform/template/wx/component-config/picker.js +3 -1
  36. package/lib/platform/template/wx/component-config/progress.js +11 -1
  37. package/lib/platform/template/wx/component-config/rich-text.js +5 -0
  38. package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
  39. package/lib/platform/template/wx/component-config/slider.js +20 -0
  40. package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
  41. package/lib/platform/template/wx/component-config/swiper.js +10 -0
  42. package/lib/platform/template/wx/component-config/text.js +5 -0
  43. package/lib/platform/template/wx/component-config/textarea.js +19 -2
  44. package/lib/platform/template/wx/component-config/unsupported.js +10 -1
  45. package/lib/platform/template/wx/component-config/video.js +10 -0
  46. package/lib/platform/template/wx/index.js +21 -1
  47. package/lib/react/index.js +2 -0
  48. package/lib/react/processJSON.js +39 -71
  49. package/lib/react/processStyles.js +3 -2
  50. package/lib/react/processTemplate.js +8 -6
  51. package/lib/react/script-helper.js +6 -16
  52. package/lib/react/style-helper.js +10 -2
  53. package/lib/resolver/AddEnvPlugin.js +13 -0
  54. package/lib/resolver/AddModePlugin.js +18 -0
  55. package/lib/runtime/components/react/context.ts +13 -6
  56. package/lib/runtime/components/react/dist/context.d.ts +76 -0
  57. package/lib/runtime/components/react/dist/context.d.ts.map +1 -0
  58. package/lib/runtime/components/react/dist/context.js +1 -0
  59. package/lib/runtime/components/react/dist/event.config.d.ts +8 -0
  60. package/lib/runtime/components/react/dist/event.config.d.ts.map +1 -0
  61. package/lib/runtime/components/react/dist/getInnerListeners.d.ts +8 -0
  62. package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +1 -0
  63. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +13 -0
  64. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +1 -0
  65. package/lib/runtime/components/react/dist/mpx-button.d.ts +69 -0
  66. package/lib/runtime/components/react/dist/mpx-button.d.ts.map +1 -0
  67. package/lib/runtime/components/react/dist/mpx-camera.d.ts +27 -0
  68. package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +1 -0
  69. package/lib/runtime/components/react/dist/mpx-camera.jsx +197 -0
  70. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +24 -0
  71. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +1 -0
  72. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +8 -0
  73. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +1 -0
  74. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +7 -0
  75. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +1 -0
  76. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +21 -0
  77. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +1 -0
  78. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +9 -0
  79. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +1 -0
  80. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +11 -0
  81. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +1 -0
  82. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +3 -0
  83. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +1 -0
  84. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +33 -0
  85. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +1 -0
  86. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +53 -0
  87. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +1 -0
  88. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +21 -0
  89. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +1 -0
  90. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +33 -0
  91. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +1 -0
  92. package/lib/runtime/components/react/dist/mpx-form.d.ts +28 -0
  93. package/lib/runtime/components/react/dist/mpx-form.d.ts.map +1 -0
  94. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +19 -0
  95. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +1 -0
  96. package/lib/runtime/components/react/dist/mpx-image.d.ts +22 -0
  97. package/lib/runtime/components/react/dist/mpx-image.d.ts.map +1 -0
  98. package/lib/runtime/components/react/dist/mpx-image.jsx +81 -37
  99. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +8 -0
  100. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +1 -0
  101. package/lib/runtime/components/react/dist/mpx-input.d.ts +51 -0
  102. package/lib/runtime/components/react/dist/mpx-input.d.ts.map +1 -0
  103. package/lib/runtime/components/react/dist/mpx-input.jsx +37 -11
  104. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +13 -0
  105. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +1 -0
  106. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +61 -50
  107. package/lib/runtime/components/react/dist/mpx-label.d.ts +21 -0
  108. package/lib/runtime/components/react/dist/mpx-label.d.ts.map +1 -0
  109. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +21 -0
  110. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +1 -0
  111. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +66 -0
  112. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +1 -0
  113. package/lib/runtime/components/react/dist/mpx-nav.d.ts +9 -0
  114. package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +1 -0
  115. package/lib/runtime/components/react/dist/mpx-nav.jsx +132 -0
  116. package/lib/runtime/components/react/dist/mpx-navigator.d.ts +10 -0
  117. package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +1 -0
  118. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +7 -0
  119. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +1 -0
  120. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +8 -0
  121. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +1 -0
  122. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +7 -0
  123. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +1 -0
  124. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +7 -0
  125. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +1 -0
  126. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +7 -0
  127. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +1 -0
  128. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +3 -0
  129. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +1 -0
  130. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +7 -0
  131. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +1 -0
  132. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +7 -0
  133. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +1 -0
  134. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +107 -0
  135. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +1 -0
  136. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +33 -0
  137. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +1 -0
  138. package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +4 -3
  139. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +9 -0
  140. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +1 -0
  141. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +24 -0
  142. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +1 -0
  143. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +12 -18
  144. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +15 -0
  145. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +1 -0
  146. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +8 -11
  147. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +14 -0
  148. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +1 -0
  149. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +20 -0
  150. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +17 -0
  151. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +1 -0
  152. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +13 -0
  153. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +1 -0
  154. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +12 -0
  155. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +1 -0
  156. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +23 -0
  157. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +1 -0
  158. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +17 -0
  159. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +1 -0
  160. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +16 -0
  161. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +1 -0
  162. package/lib/runtime/components/react/dist/mpx-portal/index.jsx +5 -1
  163. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +30 -0
  164. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +1 -0
  165. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +10 -0
  166. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +1 -0
  167. package/lib/runtime/components/react/dist/mpx-progress.d.ts +24 -0
  168. package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +1 -0
  169. package/lib/runtime/components/react/dist/mpx-progress.jsx +26 -22
  170. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +21 -0
  171. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +1 -0
  172. package/lib/runtime/components/react/dist/mpx-radio.d.ts +27 -0
  173. package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +1 -0
  174. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +2 -0
  175. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +1 -0
  176. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +25 -0
  177. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +1 -0
  178. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +15 -0
  179. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +1 -0
  180. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +55 -0
  181. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +1 -0
  182. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +6 -14
  183. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +8 -0
  184. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +1 -0
  185. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +8 -0
  186. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +1 -0
  187. package/lib/runtime/components/react/dist/mpx-slider.d.ts +31 -0
  188. package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +1 -0
  189. package/lib/runtime/components/react/dist/mpx-slider.jsx +321 -0
  190. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +18 -0
  191. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +1 -0
  192. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +16 -0
  193. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +1 -0
  194. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +19 -0
  195. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +1 -0
  196. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +53 -0
  197. package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +1 -0
  198. package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -5
  199. package/lib/runtime/components/react/dist/mpx-switch.d.ts +27 -0
  200. package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +1 -0
  201. package/lib/runtime/components/react/dist/mpx-text.d.ts +23 -0
  202. package/lib/runtime/components/react/dist/mpx-text.d.ts.map +1 -0
  203. package/lib/runtime/components/react/dist/mpx-text.jsx +33 -5
  204. package/lib/runtime/components/react/dist/mpx-textarea.d.ts +8 -0
  205. package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +1 -0
  206. package/lib/runtime/components/react/dist/mpx-video.d.ts +102 -0
  207. package/lib/runtime/components/react/dist/mpx-video.d.ts.map +1 -0
  208. package/lib/runtime/components/react/dist/mpx-view.d.ts +35 -0
  209. package/lib/runtime/components/react/dist/mpx-view.d.ts.map +1 -0
  210. package/lib/runtime/components/react/dist/mpx-view.jsx +8 -11
  211. package/lib/runtime/components/react/dist/mpx-web-view.d.ts +23 -0
  212. package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +1 -0
  213. package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
  214. package/lib/runtime/components/react/dist/parser.d.ts +40 -0
  215. package/lib/runtime/components/react/dist/parser.d.ts.map +1 -0
  216. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +33 -0
  217. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +1 -0
  218. package/lib/runtime/components/react/dist/useNodesRef.d.ts +12 -0
  219. package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +1 -0
  220. package/lib/runtime/components/react/dist/utils.d.ts +123 -0
  221. package/lib/runtime/components/react/dist/utils.d.ts.map +1 -0
  222. package/lib/runtime/components/react/dist/utils.jsx +16 -6
  223. package/lib/runtime/components/react/mpx-camera.tsx +275 -0
  224. package/lib/runtime/components/react/mpx-image.tsx +89 -42
  225. package/lib/runtime/components/react/mpx-input.tsx +44 -17
  226. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +69 -49
  227. package/lib/runtime/components/react/mpx-nav.tsx +155 -0
  228. package/lib/runtime/components/react/mpx-picker-view/index.tsx +5 -2
  229. package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +26 -21
  230. package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItem.tsx +8 -12
  231. package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItemLite.tsx +55 -0
  232. package/lib/runtime/components/react/mpx-portal/index.tsx +8 -2
  233. package/lib/runtime/components/react/mpx-progress.tsx +26 -24
  234. package/lib/runtime/components/react/mpx-scroll-view.tsx +6 -17
  235. package/lib/runtime/components/react/mpx-slider.tsx +444 -0
  236. package/lib/runtime/components/react/mpx-swiper.tsx +9 -5
  237. package/lib/runtime/components/react/mpx-text.tsx +38 -5
  238. package/lib/runtime/components/react/mpx-view.tsx +8 -11
  239. package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
  240. package/lib/runtime/components/react/types/common.d.ts +19 -0
  241. package/lib/runtime/components/react/utils.tsx +15 -6
  242. package/lib/runtime/components/web/mpx-input.vue +1 -1
  243. package/lib/runtime/components/web/mpx-scroll-view.vue +7 -1
  244. package/lib/runtime/components/web/mpx-video.vue +12 -1
  245. package/lib/runtime/optionProcessor.js +3 -1
  246. package/lib/runtime/optionProcessorReact.js +4 -2
  247. package/lib/runtime/stringify.wxs +2 -2
  248. package/lib/script-setup-compiler/index.js +2 -2
  249. package/lib/style-compiler/index.js +3 -2
  250. package/lib/style-compiler/load-postcss-config.js +1 -1
  251. package/lib/style-compiler/plugins/trans-special.js +10 -2
  252. package/lib/style-compiler/strip-conditional-loader.js +178 -15
  253. package/lib/template-compiler/bind-this.js +2 -2
  254. package/lib/template-compiler/compiler.js +277 -77
  255. package/lib/template-compiler/gen-node-react.js +18 -6
  256. package/lib/template-compiler/index.js +12 -10
  257. package/lib/template-compiler/parse-exps.js +1 -1
  258. package/lib/utils/chain-assign.js +47 -0
  259. package/lib/utils/check-core-version-match.js +75 -15
  260. package/lib/utils/const.js +2 -1
  261. package/lib/utils/dom-tag-config.js +6 -6
  262. package/lib/utils/env.js +6 -1
  263. package/lib/utils/get-build-tag-component.js +35 -0
  264. package/lib/utils/pre-process-json.js +5 -0
  265. package/lib/web/index.js +2 -0
  266. package/lib/web/processJSON.js +44 -16
  267. package/lib/web/processScript.js +1 -1
  268. package/lib/web/processTemplate.js +6 -4
  269. package/lib/web/script-helper.js +19 -9
  270. package/lib/wxs/pre-loader.js +6 -6
  271. package/lib/wxss/loader.js +1 -9
  272. package/package.json +17 -5
  273. package/LICENSE +0 -433
  274. package/lib/dependencies/ImportDependencyTemplate.js +0 -50
@@ -15,9 +15,6 @@ const RecordRuntimeInfoDependency = require('../dependencies/RecordRuntimeInfoDe
15
15
  const { MPX_DISABLE_EXTRACTOR_CACHE, RESOLVE_IGNORED_ERR, JSON_JS_EXT } = require('../utils/const')
16
16
  const resolve = require('../utils/resolve')
17
17
  const resolveTabBarPath = require('../utils/resolve-tab-bar-path')
18
- const normalize = require('../utils/normalize')
19
- const mpxViewPath = normalize.lib('runtime/components/ali/mpx-view.mpx')
20
- const mpxTextPath = normalize.lib('runtime/components/ali/mpx-text.mpx')
21
18
  const resolveMpxCustomElementPath = require('../utils/resolve-mpx-custom-element-path')
22
19
 
23
20
  module.exports = function (content) {
@@ -43,7 +40,6 @@ module.exports = function (content) {
43
40
  const globalSrcMode = mpx.srcMode
44
41
  const localSrcMode = queryObj.mode
45
42
  const srcMode = localSrcMode || globalSrcMode
46
- const projectRoot = mpx.projectRoot
47
43
 
48
44
  const isApp = !(pagesMap[resourcePath] || componentsMap[resourcePath])
49
45
  const publicPath = this._compilation.outputOptions.publicPath || ''
@@ -52,46 +48,24 @@ module.exports = function (content) {
52
48
 
53
49
  const emitWarning = (msg) => {
54
50
  this.emitWarning(
55
- new Error('[json compiler][' + this.resource + ']: ' + msg)
51
+ new Error('[Mpx json error][' + this.resource + ']: ' + msg)
56
52
  )
57
53
  }
58
54
 
59
55
  const emitError = (msg) => {
60
56
  this.emitError(
61
- new Error('[json compiler][' + this.resource + ']: ' + msg)
57
+ new Error('[Mpx json error][' + this.resource + ']: ' + msg)
62
58
  )
63
59
  }
64
60
 
65
- const fillInComponentPlaceholder = (name, placeholder, placeholderEntry) => {
66
- const componentPlaceholder = json.componentPlaceholder || {}
67
- if (componentPlaceholder[name]) return
68
- componentPlaceholder[name] = placeholder
69
- json.componentPlaceholder = componentPlaceholder
70
- if (placeholderEntry && !json.usingComponents[placeholder]) json.usingComponents[placeholder] = placeholderEntry
71
- }
72
- const normalizePlaceholder = (placeholder) => {
73
- if (typeof placeholder === 'string') {
74
- const placeholderMap = mode === 'ali'
75
- ? {
76
- view: { name: 'mpx-view', resource: mpxViewPath },
77
- text: { name: 'mpx-text', resource: mpxTextPath }
78
- }
79
- : {}
80
- placeholder = placeholderMap[placeholder] || { name: placeholder }
81
- }
82
- if (!placeholder.name) {
83
- emitError('The asyncSubpackageRules configuration format of @mpxjs/webpack-plugin a is incorrect')
84
- }
85
- return placeholder
86
- }
87
-
88
61
  const {
89
62
  isUrlRequest,
90
63
  urlToRequest,
91
64
  processPage,
92
65
  processDynamicEntry,
93
66
  processComponent,
94
- processJsExport
67
+ processJsExport,
68
+ processPlaceholder
95
69
  } = createJSONHelper({
96
70
  loaderContext: this,
97
71
  emitWarning,
@@ -223,6 +197,9 @@ module.exports = function (content) {
223
197
 
224
198
  const processComponents = (components, context, callback) => {
225
199
  if (components) {
200
+ // 存在所有命中asyncSubpackageRules的组件
201
+ const asyncComponents = []
202
+ const resolveResourcePathMap = new Map()
226
203
  async.eachOf(components, (component, name, callback) => {
227
204
  processComponent(component, context, { relativePath }, (err, entry, { tarRoot, placeholder, resourcePath, queryObj = {} } = {}) => {
228
205
  if (err === RESOLVE_IGNORED_ERR) {
@@ -242,29 +219,9 @@ module.exports = function (content) {
242
219
  isDynamic: queryObj.isDynamic
243
220
  }
244
221
  }
245
- if (tarRoot) {
246
- if (placeholder) {
247
- placeholder = normalizePlaceholder(placeholder)
248
- if (placeholder.resource) {
249
- processComponent(placeholder.resource, projectRoot, { relativePath }, (err, entry) => {
250
- if (err) return callback(err)
251
- fillInComponentPlaceholder(name, placeholder.name, entry)
252
- callback()
253
- })
254
- } else {
255
- fillInComponentPlaceholder(name, placeholder.name)
256
- callback()
257
- }
258
- } else {
259
- if (!json.componentPlaceholder || !json.componentPlaceholder[name]) {
260
- const errMsg = `componentPlaceholder of "${name}" doesn't exist! \n\r`
261
- emitError(errMsg)
262
- }
263
- callback()
264
- }
265
- } else {
266
- callback()
267
- }
222
+ resolveResourcePathMap.set(name, resourcePath)
223
+ if (tarRoot) asyncComponents.push({ name, tarRoot, placeholder, relativePath })
224
+ callback()
268
225
  })
269
226
  }, (err) => {
270
227
  if (err) return callback(err)
@@ -279,7 +236,10 @@ module.exports = function (content) {
279
236
  components.element = mpxCustomElementPath
280
237
  Object.assign(components, mpx.getPackageInjectedComponentsMap(packageName))
281
238
  }
282
- callback()
239
+ // 使用async处理所有asyncComponents完成后调用callback
240
+ async.each(asyncComponents, ({ name, tarRoot, placeholder, relativePath }, callback) => {
241
+ processPlaceholder({ jsonObj: json, context, name, tarRoot, placeholder, relativePath, resolveResourcePathMap }, callback)
242
+ }, callback)
283
243
  })
284
244
  } else {
285
245
  callback()
@@ -521,10 +481,10 @@ module.exports = function (content) {
521
481
  if (json.tabBar && json.tabBar[itemKey]) {
522
482
  json.tabBar[itemKey].forEach((item, index) => {
523
483
  if (item[iconKey] && isUrlRequest(item[iconKey])) {
524
- output += `json.tabBar.${itemKey}[${index}].${iconKey} = require("${addQuery(urlToRequest(item[iconKey]), { useLocal: true })}");\n`
484
+ output += `json.tabBar.${itemKey}[${index}].${iconKey} = require("${addQuery(urlToRequest(item[iconKey]), { useLocal: true, from: 'tabbar' })}");\n`
525
485
  }
526
486
  if (item[activeIconKey] && isUrlRequest(item[activeIconKey])) {
527
- output += `json.tabBar.${itemKey}[${index}].${activeIconKey} = require("${addQuery(urlToRequest(item[activeIconKey]), { useLocal: true })}");\n`
487
+ output += `json.tabBar.${itemKey}[${index}].${activeIconKey} = require("${addQuery(urlToRequest(item[activeIconKey]), { useLocal: true, from: 'tabbar' })}");\n`
528
488
  }
529
489
  })
530
490
  }
@@ -23,13 +23,13 @@ module.exports = function (source) {
23
23
 
24
24
  const emitWarning = (msg) => {
25
25
  this.emitWarning(
26
- new Error('[plugin loader][' + this.resource + ']: ' + msg)
26
+ new Error('[Mpx json warning][' + this.resource + ']: ' + msg)
27
27
  )
28
28
  }
29
29
 
30
30
  const emitError = (msg) => {
31
31
  this.emitError(
32
- new Error('[plugin loader][' + this.resource + ']: ' + msg)
32
+ new Error('[Mpx json error][' + this.resource + ']: ' + msg)
33
33
  )
34
34
  }
35
35
 
package/lib/loader.js CHANGED
@@ -10,6 +10,7 @@ const AppEntryDependency = require('./dependencies/AppEntryDependency')
10
10
  const RecordResourceMapDependency = require('./dependencies/RecordResourceMapDependency')
11
11
  const CommonJsVariableDependency = require('./dependencies/CommonJsVariableDependency')
12
12
  const DynamicEntryDependency = require('./dependencies/DynamicEntryDependency')
13
+ const RecordModuleIdMapDependency = require('./dependencies/RecordModuleIdMapDependency')
13
14
  const tsWatchRunLoaderFilter = require('./utils/ts-loader-watch-run-loader-filter')
14
15
  const { isReact } = require('./utils/env')
15
16
  const preProcessJson = require('./utils/pre-process-json')
@@ -50,13 +51,13 @@ module.exports = function (content) {
50
51
 
51
52
  const emitWarning = (msg) => {
52
53
  this.emitWarning(
53
- new Error('[mpx-loader][' + this.resource + ']: ' + msg)
54
+ new Error('[Mpx json warning][' + this.resource + ']: ' + msg)
54
55
  )
55
56
  }
56
57
 
57
58
  const emitError = (msg) => {
58
59
  this.emitError(
59
- new Error('[mpx-loader][' + this.resource + ']: ' + msg)
60
+ new Error('[Mpx json error][' + this.resource + ']: ' + msg)
60
61
  )
61
62
  }
62
63
 
@@ -87,6 +88,7 @@ module.exports = function (content) {
87
88
  const isProduction = this.minimize || process.env.NODE_ENV === 'production'
88
89
  const filePath = this.resourcePath
89
90
  const moduleId = mpx.getModuleId(resourcePath, ctorType === 'app')
91
+ this._module.addPresentationalDependency(new RecordModuleIdMapDependency(moduleId, resourcePath))
90
92
 
91
93
  const parts = parseComponent(content, {
92
94
  filePath,
@@ -121,6 +123,7 @@ module.exports = function (content) {
121
123
  componentPlaceholder,
122
124
  componentGenerics,
123
125
  usingComponentsInfo,
126
+ originalUsingComponents,
124
127
  jsonContent
125
128
  } = jsonInfo
126
129
  const hasScoped = parts.styles.some(({ scoped }) => scoped) || autoScope
@@ -144,7 +147,8 @@ module.exports = function (content) {
144
147
  hasScoped,
145
148
  hasComment,
146
149
  isNative,
147
- usingComponentsInfo: JSON.stringify(usingComponentsInfo),
150
+ usingComponentsInfo,
151
+ originalUsingComponents,
148
152
  componentGenerics,
149
153
  autoScope,
150
154
  callback
@@ -166,7 +170,8 @@ module.exports = function (content) {
166
170
  hasScoped,
167
171
  hasComment,
168
172
  isNative,
169
- usingComponentsInfo: JSON.stringify(usingComponentsInfo),
173
+ usingComponentsInfo,
174
+ originalUsingComponents,
170
175
  componentGenerics,
171
176
  autoScope,
172
177
  callback
@@ -235,6 +240,7 @@ module.exports = function (content) {
235
240
  ctorType,
236
241
  moduleId,
237
242
  usingComponentsInfo: JSON.stringify(usingComponentsInfo),
243
+ originalUsingComponents: JSON.stringify(originalUsingComponents),
238
244
  componentPlaceholder
239
245
  // 添加babel处理渲染函数中可能包含的...展开运算符
240
246
  // 由于...运算符应用范围极小以及babel成本极高,先关闭此特性后续看情况打开
@@ -8,6 +8,7 @@ const { JSON_JS_EXT } = require('./utils/const')
8
8
  const getEntryName = require('./utils/get-entry-name')
9
9
  const AppEntryDependency = require('./dependencies/AppEntryDependency')
10
10
  const RecordResourceMapDependency = require('./dependencies/RecordResourceMapDependency')
11
+ const RecordModuleIdMapDependency = require('./dependencies/RecordModuleIdMapDependency')
11
12
  const preProcessJson = require('./utils/pre-process-json')
12
13
 
13
14
  // todo native-loader考虑与mpx-loader或加强复用,原生组件约等于4个区块都为src的.mpx文件
@@ -23,7 +24,9 @@ module.exports = function (content) {
23
24
  const loaderContext = this
24
25
  const isProduction = this.minimize || process.env.NODE_ENV === 'production'
25
26
  const filePath = this.resourcePath
26
- const moduleId = mpx.getModuleId(filePath)
27
+ const moduleId = mpx.getModuleId(filePath, false, this)
28
+ this._module.addPresentationalDependency(new RecordModuleIdMapDependency(moduleId, filePath))
29
+
27
30
  const { resourcePath, queryObj } = parseRequest(this.resource)
28
31
  const packageRoot = queryObj.packageRoot || mpx.currentPackageRoot
29
32
  const mode = mpx.mode
@@ -104,13 +107,13 @@ module.exports = function (content) {
104
107
 
105
108
  const emitWarning = (msg) => {
106
109
  this.emitWarning(
107
- new Error('[native-loader][' + this.resource + ']: ' + msg)
110
+ new Error('[Mpx json warning][native-loader][' + this.resource + ']: ' + msg)
108
111
  )
109
112
  }
110
113
 
111
114
  const emitError = (msg) => {
112
115
  this.emitError(
113
- new Error('[native-loader][' + this.resource + ']: ' + msg)
116
+ new Error('[Mpx json error][native-loader][' + this.resource + ']: ' + msg)
114
117
  )
115
118
  }
116
119
  let ctorType = pagesMap[resourcePath]
@@ -1,12 +1,9 @@
1
1
  const runRules = require('../../run-rules')
2
2
  const normalizeTest = require('../normalize-test')
3
3
  const changeKey = require('../change-key')
4
- const normalize = require('../../../utils/normalize')
5
4
  const { capitalToHyphen } = require('../../../utils/string')
6
5
  const { isOriginTag, isBuildInWebTag, isBuildInReactTag } = require('../../../utils/dom-tag-config')
7
-
8
- const mpxViewPath = normalize.lib('runtime/components/ali/mpx-view.mpx')
9
- const mpxTextPath = normalize.lib('runtime/components/ali/mpx-text.mpx')
6
+ const getBuildInTagComponent = require('../../../utils/get-build-tag-component')
10
7
 
11
8
  module.exports = function getSpec ({ warn, error }) {
12
9
  function print (mode, path, isError) {
@@ -46,28 +43,26 @@ module.exports = function getSpec ({ warn, error }) {
46
43
  }
47
44
 
48
45
  // 处理支付宝 componentPlaceholder 不支持 view、text 原生标签
49
- function aliComponentPlaceholderFallback (input) {
50
- // 处理 驼峰转连字符
51
- input = componentNameCapitalToHyphen('componentPlaceholder')(input)
46
+ // placeholder 中使用的内建组件转化为 mpx-xxx, 并在 usingComponents 填充
47
+ function fixComponentPlaceholder (input, { mode }) {
48
+ if (!input.componentPlaceholder) return input
49
+ if (mode === 'ali') {
50
+ // 处理 驼峰转连字符
51
+ input = componentNameCapitalToHyphen('componentPlaceholder')(input)
52
+ }
52
53
  const componentPlaceholder = input.componentPlaceholder
53
- const usingComponents = input.usingComponents || (input.usingComponents = {})
54
+ const usingComponents = input.usingComponents || {}
54
55
  for (const cph in componentPlaceholder) {
55
56
  const cur = componentPlaceholder[cph]
56
- const placeholderCompMatched = cur.match(/^(?:view|text)$/g)
57
- if (!Array.isArray(placeholderCompMatched)) continue
58
- let compName, compPath
59
- switch (placeholderCompMatched[0]) {
60
- case 'view':
61
- compName = 'mpx-view'
62
- compPath = mpxViewPath
63
- break
64
- case 'text':
65
- compName = 'mpx-text'
66
- compPath = mpxTextPath
67
- }
68
- usingComponents[compName] = compPath
69
- componentPlaceholder[cph] = compName
57
+ const comp = getBuildInTagComponent(mode, cur)
58
+ if (!comp || usingComponents[cur]) continue
59
+ const { name, resource } = comp
60
+ usingComponents[name] = resource
61
+ componentPlaceholder[cph] = name
70
62
  }
63
+
64
+ input.usingComponents = usingComponents
65
+ input.componentPlaceholder = componentPlaceholder
71
66
  return input
72
67
  }
73
68
 
@@ -172,7 +167,6 @@ module.exports = function getSpec ({ warn, error }) {
172
167
  },
173
168
  {
174
169
  test: 'componentPlaceholder',
175
- ali: aliComponentPlaceholderFallback,
176
170
  swan: deletePath(),
177
171
  jd: deletePath()
178
172
  },
@@ -185,11 +179,19 @@ module.exports = function getSpec ({ warn, error }) {
185
179
  swan: addGlobalComponents,
186
180
  qq: addGlobalComponents,
187
181
  tt: addGlobalComponents,
182
+ ks: addGlobalComponents,
188
183
  jd: addGlobalComponents,
189
184
  web: fixComponentName,
190
185
  ios: fixComponentName,
191
186
  android: fixComponentName,
192
187
  harmony: fixComponentName
188
+ },
189
+ {
190
+ ali: fixComponentPlaceholder,
191
+ web: fixComponentPlaceholder,
192
+ ios: fixComponentPlaceholder,
193
+ android: fixComponentPlaceholder,
194
+ harmony: fixComponentPlaceholder
193
195
  }
194
196
  ]
195
197
 
@@ -283,6 +285,7 @@ module.exports = function getSpec ({ warn, error }) {
283
285
  'swan',
284
286
  'qq',
285
287
  'tt',
288
+ 'ks',
286
289
  'jd',
287
290
  'qa',
288
291
  'dd',
@@ -400,6 +403,7 @@ module.exports = function getSpec ({ warn, error }) {
400
403
  qq: fillGlobalComponents,
401
404
  swan: fillGlobalComponents,
402
405
  tt: fillGlobalComponents,
406
+ ks: fillGlobalComponents,
403
407
  jd: fillGlobalComponents
404
408
  },
405
409
  {
@@ -407,6 +411,7 @@ module.exports = function getSpec ({ warn, error }) {
407
411
  qq: deletePath({ noLog: true }),
408
412
  swan: deletePath({ noLog: true }),
409
413
  tt: deletePath({ noLog: true }),
414
+ ks: deletePath({ noLog: true }),
410
415
  jd: deletePath({ noLog: true })
411
416
  },
412
417
  {
@@ -445,6 +450,7 @@ module.exports = function getSpec ({ warn, error }) {
445
450
  qq: getTabBarRule(),
446
451
  swan: getTabBarRule(),
447
452
  tt: getTabBarRule(),
453
+ ks: getTabBarRule(),
448
454
  jd: getTabBarRule()
449
455
  },
450
456
  {
@@ -453,13 +459,8 @@ module.exports = function getSpec ({ warn, error }) {
453
459
  qq: getWindowRule(),
454
460
  swan: getWindowRule(),
455
461
  tt: getWindowRule(),
462
+ ks: getWindowRule(),
456
463
  jd: getWindowRule()
457
- },
458
- {
459
- web: fixComponentName,
460
- ios: fixComponentName,
461
- android: fixComponentName,
462
- harmony: fixComponentName
463
464
  }
464
465
  ]
465
466
  }
@@ -315,7 +315,7 @@ module.exports = function getSpec ({ warn, error }) {
315
315
  switch (prop) {
316
316
  case bgPropMap.image: {
317
317
  // background-image 支持背景图/渐变/css var
318
- if (cssVariableExp.test(value) || urlExp.test(value) || linearExp.test(value)) {
318
+ if (cssVariableExp.test(value) || urlExp.test(value) || linearExp.test(value) || value === 'none') {
319
319
  return { prop, value }
320
320
  } else {
321
321
  error(`Value of ${prop} in ${selector} selector only support value <url()> or <linear-gradient()>, received ${value}, please check again!`)
@@ -359,6 +359,13 @@ module.exports = function getSpec ({ warn, error }) {
359
359
  error(`Property [${bgPropMap.all}] in ${selector} is abbreviated property and does not support CSS var`)
360
360
  return false
361
361
  }
362
+ // background: none
363
+ if (value === 'none') {
364
+ return [
365
+ { prop: bgPropMap.image, value },
366
+ { prop: bgPropMap.color, value: 'transparent' }
367
+ ]
368
+ }
362
369
  const bgMap = []
363
370
  const values = parseValues(value)
364
371
  values.forEach(item => {
@@ -8,6 +8,7 @@ module.exports = function ({ print }) {
8
8
  const qqValueWarningLog = print({ platform: 'qq', type: 'value', tag: TAG_NAME, isError: false })
9
9
  const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
10
10
  const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
11
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
11
12
  return {
12
13
  test: TAG_NAME,
13
14
  props: [
@@ -43,6 +44,10 @@ module.exports = function ({ print }) {
43
44
  test: /^(ad-intervals|ad-theme)$/,
44
45
  qq: qqPropLog,
45
46
  swan: baiduPropLog
47
+ },
48
+ {
49
+ test: /^(ad-intervals|ad-type|ad-params)$/,
50
+ ks: ksPropLog
46
51
  }
47
52
  ],
48
53
  event: [
@@ -29,15 +29,20 @@ module.exports = function ({ print }) {
29
29
  const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
30
30
  const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
31
31
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
32
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
33
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
32
34
  const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' })
33
35
  const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
36
+ const iosValueLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'value' })
34
37
  const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
35
38
  const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
36
39
  const androidValueLogError = print({ platform: 'android', tag: TAG_NAME, isError: true, type: 'value' })
40
+ const androidValueLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'value' })
37
41
  const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
38
42
  const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
39
43
 
40
44
  const harmonyValueLogError = print({ platform: 'harmony', tag: TAG_NAME, isError: true, type: 'value' })
45
+ const harmonyValueLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'value' })
41
46
  const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
42
47
  const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
43
48
 
@@ -133,19 +138,25 @@ module.exports = function ({ print }) {
133
138
  ios ({ name, value }) {
134
139
  // TODO 此处open-type无其他属性支持了?
135
140
  const supported = ['share']
136
- if (!supported.includes(value)) {
141
+ if (isMustache(value)) {
142
+ iosValueLog({ name, value })
143
+ } else if (!supported.includes(value)) {
137
144
  iosValueLogError({ name, value })
138
145
  }
139
146
  },
140
147
  android ({ name, value }) {
141
148
  const supported = ['share']
142
- if (!supported.includes(value)) {
149
+ if (isMustache(value)) {
150
+ androidValueLog({ name, value })
151
+ } else if (!supported.includes(value)) {
143
152
  androidValueLogError({ name, value })
144
153
  }
145
154
  },
146
155
  harmony ({ name, value }) {
147
156
  const supported = ['share']
148
- if (!supported.includes(value)) {
157
+ if (isMustache(value)) {
158
+ harmonyValueLog({ name, value })
159
+ } else if (!supported.includes(value)) {
149
160
  harmonyValueLogError({ name, value })
150
161
  }
151
162
  }
@@ -190,6 +201,10 @@ module.exports = function ({ print }) {
190
201
  ios: iosPropLog,
191
202
  android: androidPropLog,
192
203
  harmony: harmonyPropLog
204
+ },
205
+ {
206
+ test: /^(hover-stop-propagation|session-from|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|app-parameter|phone-number-no-quota-toast|need-show-entrance|entrance-path)$/,
207
+ ks: ksPropLog
193
208
  }
194
209
  ],
195
210
  event: [
@@ -224,10 +239,11 @@ module.exports = function ({ print }) {
224
239
  web: webEventLog
225
240
  },
226
241
  {
227
- test: /^(getuserinfo|contact|getphonenumber|bindgetrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
242
+ test: /^(getuserinfo|contact|getphonenumber|getrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
228
243
  ios: iosEventLog,
229
244
  android: androidEventLog,
230
- harmony: harmonyEventLog
245
+ harmony: harmonyEventLog,
246
+ ks: ksEventLog
231
247
  }
232
248
  ]
233
249
  }
@@ -13,8 +13,23 @@ module.exports = function ({ print }) {
13
13
  const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
14
14
  const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
15
15
  const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
16
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
17
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
18
+
16
19
  return {
17
20
  test: TAG_NAME,
21
+ ios (tag, { el }) {
22
+ el.isBuiltIn = true
23
+ return 'mpx-camera'
24
+ },
25
+ android (tag, { el }) {
26
+ el.isBuiltIn = true
27
+ return 'mpx-camera'
28
+ },
29
+ harmony (tag, { el }) {
30
+ el.isBuiltIn = true
31
+ return 'mpx-camera'
32
+ },
18
33
  props: [
19
34
  {
20
35
  test: 'mode',
@@ -46,7 +61,8 @@ module.exports = function ({ print }) {
46
61
  },
47
62
  {
48
63
  test: /^(resolution|frame-size)$/,
49
- qq: qqPropLog
64
+ qq: qqPropLog,
65
+ ks: ksPropLog
50
66
  },
51
67
  {
52
68
  test: /^(frame-size|device-position)$/,
@@ -73,11 +89,17 @@ module.exports = function ({ print }) {
73
89
  test: /^(scancode)$/,
74
90
  swan: baiduEventLog,
75
91
  tt: ttEventLog,
76
- qa: qaEventLog
92
+ qa: qaEventLog,
93
+ ks: ksEventLog
77
94
  },
78
95
  {
79
96
  test: /^(initdone)$/,
80
- qq: qqEventLog
97
+ qq: qqEventLog,
98
+ ks: ksEventLog
99
+ },
100
+ {
101
+ test: /^(stop|error)$/,
102
+ ks: ksEventLog
81
103
  }
82
104
  ]
83
105
  }
@@ -6,6 +6,8 @@ module.exports = function ({ print }) {
6
6
  const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
7
7
  const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
8
8
  const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
9
+ const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
10
+ const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
9
11
  return {
10
12
  test: TAG_NAME,
11
13
  android (tag, { el }) {
@@ -37,6 +39,10 @@ module.exports = function ({ print }) {
37
39
  {
38
40
  test: 'type',
39
41
  jd: jdPropLog
42
+ },
43
+ {
44
+ test: /^(type|disable-scroll)$/,
45
+ ks: ksPropLog
40
46
  }
41
47
  ],
42
48
  // 组件事件中的差异部分
@@ -63,7 +69,8 @@ module.exports = function ({ print }) {
63
69
  {
64
70
  test: /^(longtap|error)$/,
65
71
  tt: ttEventLog,
66
- qa: qaEventLog
72
+ qa: qaEventLog,
73
+ ks: ksEventLog
67
74
  }
68
75
  ]
69
76
  }
@@ -1,43 +1,41 @@
1
- const { parseMustache } = require('../../../../template-compiler/compiler')
2
- const normalize = require('../../../../utils/normalize')
3
1
  const TAG_NAME = 'component'
4
2
 
5
- /** is 属性格式化为中划线(-)连接 */
6
- const formatPropIs = (obj, data) => {
7
- const parsed = parseMustache(obj.value)
8
- let value = parsed.result
9
- if (parsed.hasBinding) value = value.slice(1, -1)
10
- const el = data.el
11
- if (el) {
12
- const injectWxsProp = {
13
- injectWxsPath: '~' + normalize.lib('runtime/utils.wxs'),
14
- injectWxsModuleName: '__wxsUtils__'
15
- }
16
- if (el.injectWxsProps && Array.isArray(el.injectWxsProps)) {
17
- el.injectWxsProps.push(injectWxsProp)
18
- } else {
19
- el.injectWxsProps = [injectWxsProp]
20
- }
21
- }
22
- return {
23
- name: 'is',
24
- value: `{{__wxsUtils__.humpToLine(${value})}}`
25
- }
26
- }
3
+ /** is 属性格式化为中划线(-)连接 (弃用,新方案:https://github.com/didi/mpx/pull/2228) */
4
+ // const formatPropIs = (obj, data) => {
5
+ // const parsed = parseMustache(obj.value)
6
+ // let value = parsed.result
7
+ // if (parsed.hasBinding) value = value.slice(1, -1)
8
+ // const el = data.el
9
+ // if (el) {
10
+ // const injectWxsProp = {
11
+ // injectWxsPath: '~' + normalize.lib('runtime/utils.wxs'),
12
+ // injectWxsModuleName: '__wxsUtils__'
13
+ // }
14
+ // if (el.injectWxsProps && Array.isArray(el.injectWxsProps)) {
15
+ // el.injectWxsProps.push(injectWxsProp)
16
+ // } else {
17
+ // el.injectWxsProps = [injectWxsProp]
18
+ // }
19
+ // }
20
+ // return {
21
+ // name: 'is',
22
+ // value: `{{__wxsUtils__.humpToLine(${value})}}`
23
+ // }
24
+ // }
27
25
 
28
26
  module.exports = function () {
29
27
  return {
30
28
  test: TAG_NAME,
31
29
  props: [
32
- {
33
- test: 'is',
34
- ali (obj, data) {
35
- return formatPropIs(obj, data)
36
- },
37
- swan (obj, data) {
38
- return formatPropIs(obj, data)
39
- }
40
- }
30
+ // {
31
+ // test: 'is',
32
+ // ali (obj, data) {
33
+ // return formatPropIs(obj, data)
34
+ // },
35
+ // swan (obj, data) {
36
+ // return formatPropIs(obj, data)
37
+ // }
38
+ // }
41
39
  ]
42
40
  }
43
41
  }