@mpxjs/webpack-plugin 2.10.17-beta.3 → 2.10.17-beta.6

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 (228) hide show
  1. package/lib/config.js +60 -0
  2. package/lib/file-loader.js +4 -1
  3. package/lib/global.d.ts +245 -0
  4. package/lib/index.js +29 -2
  5. package/lib/json-compiler/index.js +13 -4
  6. package/lib/loader.js +4 -0
  7. package/lib/platform/json/wx/index.js +6 -0
  8. package/lib/platform/style/wx/index.js +57 -33
  9. package/lib/platform/template/wx/component-config/ad.js +5 -0
  10. package/lib/platform/template/wx/component-config/button.js +10 -3
  11. package/lib/platform/template/wx/component-config/camera.js +25 -3
  12. package/lib/platform/template/wx/component-config/canvas.js +8 -1
  13. package/lib/platform/template/wx/component-config/cover-image.js +7 -2
  14. package/lib/platform/template/wx/component-config/cover-view.js +3 -1
  15. package/lib/platform/template/wx/component-config/form.js +27 -2
  16. package/lib/platform/template/wx/component-config/image.js +5 -0
  17. package/lib/platform/template/wx/component-config/input.js +11 -1
  18. package/lib/platform/template/wx/component-config/label.js +10 -2
  19. package/lib/platform/template/wx/component-config/map.js +11 -0
  20. package/lib/platform/template/wx/component-config/movable-area.js +4 -1
  21. package/lib/platform/template/wx/component-config/movable-view.js +17 -2
  22. package/lib/platform/template/wx/component-config/navigator.js +26 -0
  23. package/lib/platform/template/wx/component-config/picker-view.js +12 -0
  24. package/lib/platform/template/wx/component-config/picker.js +3 -1
  25. package/lib/platform/template/wx/component-config/progress.js +11 -1
  26. package/lib/platform/template/wx/component-config/rich-text.js +5 -0
  27. package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
  28. package/lib/platform/template/wx/component-config/slider.js +8 -0
  29. package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
  30. package/lib/platform/template/wx/component-config/swiper.js +10 -0
  31. package/lib/platform/template/wx/component-config/text.js +5 -0
  32. package/lib/platform/template/wx/component-config/textarea.js +20 -3
  33. package/lib/platform/template/wx/component-config/unsupported.js +10 -1
  34. package/lib/platform/template/wx/component-config/video.js +10 -0
  35. package/lib/platform/template/wx/index.js +21 -1
  36. package/lib/react/LoadAsyncChunkModule.js +1 -1
  37. package/lib/react/processStyles.js +21 -9
  38. package/lib/react/style-helper.js +76 -13
  39. package/lib/resolver/AddModePlugin.js +23 -8
  40. package/lib/runtime/components/react/animationHooks/index.ts +75 -0
  41. package/lib/runtime/components/react/animationHooks/useAnimationAPIHooks.ts +198 -0
  42. package/lib/runtime/components/react/animationHooks/useTransitionHooks.ts +297 -0
  43. package/lib/runtime/components/react/animationHooks/utils.ts +196 -0
  44. package/lib/runtime/components/react/context.ts +7 -1
  45. package/lib/runtime/components/react/dist/animationHooks/index.d.ts +15 -0
  46. package/lib/runtime/components/react/dist/animationHooks/index.js +67 -0
  47. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +3 -0
  48. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.js +182 -0
  49. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +3 -0
  50. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.js +274 -0
  51. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +109 -0
  52. package/lib/runtime/components/react/dist/animationHooks/utils.js +150 -0
  53. package/lib/runtime/components/react/dist/context.d.ts +6 -2
  54. package/lib/runtime/components/react/dist/event.config.d.ts +0 -1
  55. package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -1
  56. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -1
  57. package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
  58. package/lib/runtime/components/react/dist/mpx-camera.d.ts +31 -0
  59. package/lib/runtime/components/react/dist/mpx-camera.jsx +236 -0
  60. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -1
  61. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -1
  62. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -1
  63. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -1
  64. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -1
  65. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -1
  66. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -1
  67. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
  68. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -1
  69. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
  70. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
  71. package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
  72. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
  73. package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
  74. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -1
  75. package/lib/runtime/components/react/dist/mpx-input.d.ts +2 -1
  76. package/lib/runtime/components/react/dist/mpx-input.jsx +10 -9
  77. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -1
  78. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +7 -2
  79. package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
  80. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
  81. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -1
  82. package/lib/runtime/components/react/dist/mpx-nav.d.ts +0 -1
  83. package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -1
  84. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -1
  85. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -1
  86. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -1
  87. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -1
  88. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -1
  89. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -1
  90. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -1
  91. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -1
  92. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -1
  93. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -1
  94. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -1
  95. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -1
  96. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -1
  97. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -1
  98. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -1
  99. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -1
  100. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -1
  101. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -1
  102. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -1
  103. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -1
  104. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -1
  105. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -1
  106. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +2 -2
  107. package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
  108. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
  109. package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
  110. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -1
  111. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
  112. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -1
  113. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
  114. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -1
  115. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
  116. package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
  117. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
  118. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
  119. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
  120. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +11 -1
  121. package/lib/runtime/components/react/dist/mpx-swiper.jsx +71 -39
  122. package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
  123. package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
  124. package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -1
  125. package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
  126. package/lib/runtime/components/react/dist/mpx-view.d.ts +3 -3
  127. package/lib/runtime/components/react/dist/mpx-view.jsx +22 -8
  128. package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -1
  129. package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
  130. package/lib/runtime/components/react/dist/parser.d.ts +0 -1
  131. package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -1
  132. package/lib/runtime/components/react/dist/utils.d.ts +1 -1
  133. package/lib/runtime/components/react/dist/utils.jsx +34 -13
  134. package/lib/runtime/components/react/mpx-camera.tsx +327 -0
  135. package/lib/runtime/components/react/mpx-input.tsx +15 -9
  136. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +7 -2
  137. package/lib/runtime/components/react/mpx-portal/portal-manager.tsx +2 -2
  138. package/lib/runtime/components/react/mpx-swiper.tsx +86 -37
  139. package/lib/runtime/components/react/mpx-view.tsx +27 -12
  140. package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
  141. package/lib/runtime/components/react/tsconfig.json +26 -0
  142. package/lib/runtime/components/react/types/global.d.ts +1 -0
  143. package/lib/runtime/components/react/utils.tsx +34 -16
  144. package/lib/runtime/optionProcessor.js +5 -0
  145. package/lib/runtime/optionProcessorReact.js +7 -0
  146. package/lib/runtime/stringify.wxs +2 -2
  147. package/lib/style-compiler/strip-conditional-loader/rebaseUrl.js +225 -0
  148. package/lib/style-compiler/strip-conditional-loader.js +76 -185
  149. package/lib/template-compiler/compiler.js +1 -3
  150. package/lib/utils/dom-tag-config.js +1 -1
  151. package/lib/utils/string.js +25 -1
  152. package/package.json +6 -4
  153. package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
  154. package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
  155. package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
  156. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
  157. package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
  158. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
  159. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
  160. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
  161. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
  162. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
  163. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
  164. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
  165. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
  166. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
  167. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
  168. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
  169. package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
  170. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
  171. package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
  172. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
  173. package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
  174. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
  175. package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
  176. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
  177. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
  178. package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
  179. package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
  180. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
  181. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
  182. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
  183. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
  184. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
  185. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
  186. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
  187. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
  188. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
  189. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
  190. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
  191. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
  192. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
  193. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
  194. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
  195. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
  196. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
  197. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
  198. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
  199. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
  200. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
  201. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
  202. package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
  203. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
  204. package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
  205. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
  206. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
  207. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
  208. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
  209. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
  210. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
  211. package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
  212. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
  213. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
  214. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
  215. package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
  216. package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
  217. package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
  218. package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
  219. package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
  220. package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
  221. package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
  222. package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
  223. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -33
  224. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
  225. package/lib/runtime/components/react/dist/useAnimationHooks.js +0 -289
  226. package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
  227. package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
  228. package/lib/runtime/components/react/useAnimationHooks.ts +0 -320
package/lib/config.js CHANGED
@@ -553,6 +553,66 @@ module.exports = {
553
553
  show: 'dd:show'
554
554
  }
555
555
  },
556
+ ks: {
557
+ typeExtMap: {
558
+ json: '.json',
559
+ script: '.js',
560
+ template: '.ksml',
561
+ styles: '.css'
562
+ },
563
+ tabBar: {
564
+ itemKey: 'list',
565
+ iconKey: 'iconPath',
566
+ activeIconKey: 'selectedIconPath'
567
+ },
568
+ event: {
569
+ parseEvent (attr) {
570
+ const match = /^(bind|catch|capture-bind|capture-catch):?(.*?)(?:\.(.*))?$/.exec(attr)
571
+ if (match) {
572
+ return {
573
+ prefix: match[1],
574
+ eventName: match[2],
575
+ modifier: match[3]
576
+ }
577
+ }
578
+ },
579
+ getEvent (eventName, prefix = 'bind') {
580
+ if (eventName.includes('-')) {
581
+ return `${prefix}:${eventName}`
582
+ } else {
583
+ return prefix + eventName
584
+ }
585
+ },
586
+ defaultModelProp: 'value',
587
+ defaultModelEvent: 'input',
588
+ defaultModelValuePath: 'value'
589
+ },
590
+ wxs: {
591
+ tag: 'ks',
592
+ module: 'module',
593
+ src: 'src',
594
+ ext: '.ks',
595
+ templatePrefix: 'module.exports = \n'
596
+ },
597
+ directive: {
598
+ if: 'ks:if',
599
+ elseif: 'ks:elif',
600
+ else: 'ks:else',
601
+ for: 'ks:for',
602
+ forIndex: 'ks:for-index',
603
+ forItem: 'ks:for-item',
604
+ key: 'ks:key',
605
+ dynamicClass: 'ks:class',
606
+ dynamicStyle: 'ks:style',
607
+ ref: 'ks:ref',
608
+ show: 'ks:show',
609
+ model: 'ks:model',
610
+ modelProp: 'ks:model-prop',
611
+ modelEvent: 'ks:model-event',
612
+ modelValuePath: 'ks:model-value-path',
613
+ modelFilter: 'ks:model-filter'
614
+ }
615
+ },
556
616
  ios: reactConfig,
557
617
  android: reactConfig,
558
618
  harmony: reactConfig
@@ -8,7 +8,9 @@ module.exports = function loader (content, prevOptions) {
8
8
  const options = prevOptions || loaderUtils.getOptions(this) || {}
9
9
  const context = options.context || this.rootContext
10
10
  const mpx = this.getMpx()
11
- const isRN = ['ios', 'android', 'harmony'].includes(mpx.mode)
11
+
12
+ const { mode } = mpx
13
+ const isRN = ['ios', 'android', 'harmony'].includes(mode)
12
14
 
13
15
  let url = loaderUtils.interpolateName(this, options.name, {
14
16
  context,
@@ -47,6 +49,7 @@ module.exports = function loader (content, prevOptions) {
47
49
  ? options.publicPath
48
50
  : `${options.publicPath}/`}${url}`
49
51
  }
52
+
50
53
  publicPath = JSON.stringify(publicPath)
51
54
  }
52
55
 
@@ -0,0 +1,245 @@
1
+ import * as webpack from 'webpack'
2
+
3
+ declare module 'webpack' {
4
+ interface Compilation {
5
+ __mpx__: MpxContext
6
+ }
7
+
8
+ interface Compiler {
9
+ __mpx__?: boolean
10
+ }
11
+ }
12
+
13
+ declare global {
14
+ interface MpxWebpackPluginOptions {
15
+ style: {
16
+ cssCondition?: {
17
+ before?: boolean
18
+ after?: boolean
19
+ beforeExclude?: (string | RegExp)[]
20
+ afterExclude?: (string | RegExp)[]
21
+ legacy?: boolean
22
+ afterLegacy?: boolean
23
+ beforeLegacy?: boolean
24
+ }
25
+ }
26
+ }
27
+
28
+ type MpxLoaderContext<T> = webpack.LoaderContext<T> & {
29
+ getMpx(): MpxContext
30
+ }
31
+
32
+ interface MpxContext {
33
+ /**
34
+ * 用于使用 webpack-virtual-modules 功能,目前仅在输出 web 时支持使用
35
+ */
36
+ __vfs: any | null
37
+
38
+ /**
39
+ * app 信息,便于获取 appName
40
+ */
41
+ appInfo: {
42
+ resourcePath?: string
43
+ name?: string
44
+ [key: string]: any
45
+ }
46
+
47
+ /**
48
+ * pageConfig 信息
49
+ */
50
+ pageConfigsMap: Record<string, any>
51
+
52
+ /**
53
+ * pages 全局记录,无需区分主包/分包
54
+ */
55
+ pagesMap: Record<string, string>
56
+
57
+ /**
58
+ * 组件资源记录,按所属包进行记录(如 componentsMap.main)
59
+ */
60
+ componentsMap: Record<string, Record<string, string>>
61
+
62
+ /**
63
+ * 静态资源(图片、字体、独立样式)等,按所属包进行记录
64
+ */
65
+ staticResourcesMap: Record<string, Record<string, string>>
66
+
67
+ /**
68
+ * 用于记录命中 subpackageModulesRules 的 JS 模块分包归属,用于 JS 多分包冗余输出
69
+ */
70
+ subpackageModulesMap: Record<string, Record<string, string>>
71
+
72
+ /**
73
+ * 记录其他资源,如 pluginMain、pluginExport,无需区分主包/分包
74
+ */
75
+ otherResourcesMap: Record<string, any>
76
+
77
+ /**
78
+ * 记录独立分包
79
+ */
80
+ independentSubpackagesMap: Record<string, any>
81
+
82
+ subpackagesEntriesMap: Record<string, any>
83
+ postSubpackageEntriesMap: Record<string, any>
84
+ replacePathMap: Record<string, string>
85
+
86
+ /**
87
+ * 导出模块集合
88
+ */
89
+ exportModules: Set<any>
90
+
91
+ /**
92
+ * 记录动态添加入口的分包信息
93
+ */
94
+ dynamicEntryInfo: Record<string, any>
95
+
96
+ /**
97
+ * 记录 entryModule 与 entryNode 的对应关系,用于体积分析
98
+ */
99
+ entryNodeModulesMap: Map<any, any>
100
+
101
+ /**
102
+ * 记录与 asset 相关联的 modules,用于体积分析
103
+ */
104
+ assetsModulesMap: Map<string, Set<any>>
105
+
106
+ /**
107
+ * 记录与 asset 相关联的 AST,用于体积分析和 esCheck,避免重复 parse
108
+ */
109
+ assetsASTsMap: Map<string, any>
110
+
111
+ /**
112
+ * 记录 RequireExternalDependency 相关资源路径
113
+ */
114
+ externalRequestsMap: Map<string, any>
115
+
116
+ globalComponents: Record<string, any>
117
+ globalComponentsInfo: Record<string, any>
118
+
119
+ /**
120
+ * todo: es6 Map 读写性能高于 object,之后会逐步替换
121
+ */
122
+ wxsAssetsCache: Map<string, any>
123
+ addEntryPromiseMap: Map<string, Promise<any>>
124
+ currentPackageRoot: string
125
+ wxsContentMap: Record<string, string>
126
+
127
+ /**
128
+ * 是否强制使用页面构造函数
129
+ */
130
+ forceUsePageCtor: boolean
131
+
132
+ resolveMode: string
133
+ mode: string
134
+ srcMode: string
135
+ env: string
136
+ externalClasses: string[]
137
+ projectRoot: string
138
+ autoScopeRules: any
139
+ autoVirtualHostRules: any
140
+ customTextRules: any
141
+ transRpxRules: any
142
+ postcssInlineConfig: any
143
+ decodeHTMLText: boolean
144
+
145
+ /**
146
+ * native 文件专用配置
147
+ */
148
+ i18n: any | null
149
+ checkUsingComponentsRules: any
150
+ forceDisableBuiltInLoader: boolean
151
+
152
+ /**
153
+ * 默认的应用标题
154
+ */
155
+ appTitle: string
156
+
157
+ attributes: any[]
158
+ externals: any[]
159
+ useRelativePath: boolean
160
+ removedChunks: any[]
161
+ forceProxyEventRules: any
162
+
163
+ /**
164
+ * 若配置 disableRequireAsync=true,则全平台构建不支持异步分包
165
+ */
166
+ supportRequireAsync: boolean
167
+ partialCompileRules: any
168
+ asyncSubpackageRules: any[]
169
+ transSubpackageRules: any
170
+ optimizeRenderRules: any[]
171
+
172
+ addEntryModuleIssuer: (module: string, issuer: string) => void
173
+
174
+ /**
175
+ * 资源路径的哈希函数(用于生成输出唯一名)
176
+ */
177
+ pathHash: (resourcePath: string) => string
178
+
179
+ // 缓存与工具
180
+ loaderContentCache: Map<string, any>
181
+ extractedFilesCache: Map<string, string>
182
+
183
+ // 函数接口
184
+
185
+ /**
186
+ * 收集动态入口信息(分包、文件名、是否为页面、是否包含异步等)
187
+ */
188
+ collectDynamicEntryInfo: (info: { resource: string; packageName: string; filename: string; entryType: string; hasAsync: boolean }) => void
189
+
190
+ /**
191
+ * 添加入口(包装了 webpack 的 addEntry)
192
+ */
193
+ addEntry: (request: string, name: string, callback: (err?: Error, result?: any) => void) => any
194
+
195
+ getModuleId: (filePath: string, isApp?: boolean) => string
196
+ getEntryNode: (module: any, type?: string) => any
197
+
198
+ /**
199
+ * 根据资源路径和类型返回输出路径(支持自定义输出、冲突处理等)
200
+ */
201
+ getOutputPath: (resourcePath: string, type: string, opts?: { ext?: string; conflictPath?: string }) => string
202
+
203
+ /**
204
+ * 获取提取后的文件名(支持静态、插件、普通资源)
205
+ */
206
+ getExtractedFile: (resource: string, opts?: { error?: (err: Error) => void }) => string
207
+
208
+ recordResourceMap: (params: {
209
+ resourcePath: string
210
+ resourceType: string
211
+ outputPath?: string
212
+ packageRoot?: string
213
+ recordOnly?: boolean
214
+ warn?: (e: Error) => void
215
+ error?: (e: Error) => void
216
+ }) => { outputPath?: string; alreadyOutputted?: boolean }
217
+
218
+ getPackageInfo: (params: {
219
+ resource: string
220
+ resourceType: string
221
+ outputPath?: string
222
+ issuerResource?: string
223
+ warn?: (e: Error) => void
224
+ error?: (e: Error) => void
225
+ }) => { packageName: string; packageRoot: string; outputPath?: string; alreadyOutputted?: boolean }
226
+
227
+ // 运行时信息与注入相关
228
+ runtimeInfo: Record<string, any>
229
+ dynamicSlotDependencies: Record<string, any>
230
+ dynamicTemplateRuleRunner: any
231
+
232
+ /**
233
+ * 依据 package 注入到 mpx-custom-element-*.json 里面的组件路径
234
+ */
235
+ getPackageInjectedComponentsMap: (packageName?: string) => Record<string, string>
236
+
237
+ getPackageInjectedTemplateConfig: (packageName?: string) => any
238
+ injectDynamicSlotDependencies: (usingComponents: string, resourcePath: string) => string
239
+ changeHashNameForAstNode: (templateAst: string, componentsMap: any) => string
240
+ collectDynamicSlotDependencies: (packageName?: string) => void
241
+
242
+ // 其它任意扩展字段
243
+ [key: string]: any
244
+ }
245
+ }
package/lib/index.js CHANGED
@@ -79,13 +79,18 @@ const LoadAsyncChunkModule = require('./react/LoadAsyncChunkModule')
79
79
  const ExternalModule = require('webpack/lib/ExternalModule')
80
80
  const { RetryRuntimeModule, RetryRuntimeGlobal } = require('./dependencies/RetryRuntimeModule')
81
81
  const checkVersionCompatibility = require('./utils/check-core-version-match')
82
-
82
+ const { rewriteFSForCss, startFSStripForCss } = require('./style-compiler/strip-conditional-loader')
83
+ rewriteFSForCss()
83
84
  checkVersionCompatibility()
84
85
 
85
86
  const isProductionLikeMode = options => {
86
87
  return options.mode === 'production' || !options.mode
87
88
  }
88
89
 
90
+ /**
91
+ * @param {import('webpack').NormalModule} module
92
+ * @returns
93
+ */
89
94
  const isStaticModule = module => {
90
95
  if (!module.resource) return false
91
96
  const { queryObj } = parseRequest(module.resource)
@@ -322,7 +327,13 @@ class MpxWebpackPlugin {
322
327
  }
323
328
  }
324
329
 
330
+ /**
331
+ * @param {import('webpack').Compiler} compiler
332
+ */
325
333
  apply (compiler) {
334
+ // 注入 fs 代理
335
+ startFSStripForCss(this.options.defs)
336
+
326
337
  if (!compiler.__mpx__) {
327
338
  compiler.__mpx__ = true
328
339
  } else {
@@ -1729,7 +1740,14 @@ class MpxWebpackPlugin {
1729
1740
 
1730
1741
  if (isReact(mpx.mode)) {
1731
1742
  // 添加 @refresh reset 注释用于在 React HMR 时刷新组件
1732
- source.add('/* @refresh reset */\n')
1743
+ if (process.env.NODE_ENV !== 'production') {
1744
+ source.add(`/* @refresh reset */
1745
+ if (module.hot) {
1746
+ module.hot.accept(() => {
1747
+ require("react-native").DevSettings.reload();
1748
+ });
1749
+ }\n`)
1750
+ }
1733
1751
  // 注入页面的配置,供screen前置设置导航情况
1734
1752
  if (isRuntime) {
1735
1753
  source.add('// inject pageconfigmap for screen\n' +
@@ -2087,3 +2105,12 @@ try {
2087
2105
  }
2088
2106
 
2089
2107
  module.exports = MpxWebpackPlugin
2108
+
2109
+ /**
2110
+ * 定义 MpxWebpackPlugin 的配置
2111
+ * @param {MpxWebpackPluginOptions} options - 插件选项
2112
+ * @returns {MpxWebpackPluginOptions}
2113
+ */
2114
+ module.exports.defineConfig = function defineConfig(options) {
2115
+ return options
2116
+ }
@@ -472,6 +472,11 @@ module.exports = function (content) {
472
472
  }
473
473
  }
474
474
 
475
+ const wrapTabBarAsset = (expr) => {
476
+ if (mode !== 'ks') return expr
477
+ return `(function(p){return typeof p === "string" && p.charAt(0) === "/" ? p.slice(1) : p})(${expr})`
478
+ }
479
+
475
480
  const processTabBar = (output) => {
476
481
  const tabBarCfg = config[mode].tabBar
477
482
  const itemKey = tabBarCfg.itemKey
@@ -480,11 +485,15 @@ module.exports = function (content) {
480
485
 
481
486
  if (json.tabBar && json.tabBar[itemKey]) {
482
487
  json.tabBar[itemKey].forEach((item, index) => {
483
- if (item[iconKey] && isUrlRequest(item[iconKey])) {
484
- output += `json.tabBar.${itemKey}[${index}].${iconKey} = require("${addQuery(urlToRequest(item[iconKey]), { useLocal: true })}");\n`
488
+ const iconPath = item[iconKey]
489
+ if (iconPath && isUrlRequest(iconPath)) {
490
+ const iconRequire = wrapTabBarAsset(`require("${addQuery(urlToRequest(iconPath), { useLocal: true })}")`)
491
+ output += `json.tabBar.${itemKey}[${index}].${iconKey} = ${iconRequire};\n`
485
492
  }
486
- if (item[activeIconKey] && isUrlRequest(item[activeIconKey])) {
487
- output += `json.tabBar.${itemKey}[${index}].${activeIconKey} = require("${addQuery(urlToRequest(item[activeIconKey]), { useLocal: true })}");\n`
493
+ const activeIconPath = item[activeIconKey]
494
+ if (activeIconPath && isUrlRequest(activeIconPath)) {
495
+ const activeIconRequire = wrapTabBarAsset(`require("${addQuery(urlToRequest(activeIconPath), { useLocal: true })}")`)
496
+ output += `json.tabBar.${itemKey}[${index}].${activeIconKey} = ${activeIconRequire};\n`
488
497
  }
489
498
  })
490
499
  }
package/lib/loader.js CHANGED
@@ -19,6 +19,10 @@ const processWeb = require('./web')
19
19
  const processReact = require('./react')
20
20
  const genMpxCustomElement = require('./runtime-render/gen-mpx-custom-element')
21
21
 
22
+ /**
23
+ * @this {MpxLoaderContext<any>}
24
+ * @param {string} content
25
+ */
22
26
  module.exports = function (content) {
23
27
  this.cacheable()
24
28
 
@@ -179,6 +179,7 @@ module.exports = function getSpec ({ warn, error }) {
179
179
  swan: addGlobalComponents,
180
180
  qq: addGlobalComponents,
181
181
  tt: addGlobalComponents,
182
+ ks: addGlobalComponents,
182
183
  jd: addGlobalComponents,
183
184
  web: fixComponentName,
184
185
  ios: fixComponentName,
@@ -284,6 +285,7 @@ module.exports = function getSpec ({ warn, error }) {
284
285
  'swan',
285
286
  'qq',
286
287
  'tt',
288
+ 'ks',
287
289
  'jd',
288
290
  'qa',
289
291
  'dd',
@@ -401,6 +403,7 @@ module.exports = function getSpec ({ warn, error }) {
401
403
  qq: fillGlobalComponents,
402
404
  swan: fillGlobalComponents,
403
405
  tt: fillGlobalComponents,
406
+ ks: fillGlobalComponents,
404
407
  jd: fillGlobalComponents
405
408
  },
406
409
  {
@@ -408,6 +411,7 @@ module.exports = function getSpec ({ warn, error }) {
408
411
  qq: deletePath({ noLog: true }),
409
412
  swan: deletePath({ noLog: true }),
410
413
  tt: deletePath({ noLog: true }),
414
+ ks: deletePath({ noLog: true }),
411
415
  jd: deletePath({ noLog: true })
412
416
  },
413
417
  {
@@ -446,6 +450,7 @@ module.exports = function getSpec ({ warn, error }) {
446
450
  qq: getTabBarRule(),
447
451
  swan: getTabBarRule(),
448
452
  tt: getTabBarRule(),
453
+ ks: getTabBarRule(),
449
454
  jd: getTabBarRule()
450
455
  },
451
456
  {
@@ -454,6 +459,7 @@ module.exports = function getSpec ({ warn, error }) {
454
459
  qq: getWindowRule(),
455
460
  swan: getWindowRule(),
456
461
  tt: getWindowRule(),
462
+ ks: getWindowRule(),
457
463
  jd: getWindowRule()
458
464
  }
459
465
  ]
@@ -1,8 +1,9 @@
1
1
  const { hump2dash } = require('../../../utils/hump-dash')
2
+ const { parseValues } = require('../../../utils/string')
2
3
 
3
4
  module.exports = function getSpec ({ warn, error }) {
4
5
  // React Native 双端都不支持的 CSS property
5
- const unsupportedPropExp = /^(white-space|text-overflow|animation|transition|font-variant-caps|font-variant-numeric|font-variant-east-asian|font-variant-alternates|font-variant-ligatures|background-position|caret-color)$/
6
+ const unsupportedPropExp = /^(white-space|text-overflow|animation|font-variant-caps|font-variant-numeric|font-variant-east-asian|font-variant-alternates|font-variant-ligatures|background-position|caret-color)$/
6
7
  const unsupportedPropMode = {
7
8
  // React Native ios 不支持的 CSS property
8
9
  ios: /^(vertical-align)$/,
@@ -38,7 +39,7 @@ module.exports = function getSpec ({ warn, error }) {
38
39
  }
39
40
  // React 属性支持的枚举值
40
41
  const SUPPORTED_PROP_VAL_ARR = {
41
- 'box-sizing': ['border-box'],
42
+ 'box-sizing': ['border-box', 'content-box'],
42
43
  'backface-visibility': ['visible', 'hidden'],
43
44
  overflow: ['visible', 'hidden', 'scroll'],
44
45
  'border-style': ['solid', 'dotted', 'dashed'],
@@ -88,42 +89,48 @@ module.exports = function getSpec ({ warn, error }) {
88
89
  if (rule[1].test(prop)) return rule[0]
89
90
  }
90
91
  }
91
- // 多value解析
92
- const parseValues = (str, char = ' ') => {
93
- let stack = 0
94
- let temp = ''
95
- const result = []
96
- for (let i = 0; i < str.length; i++) {
97
- if (str[i] === '(') {
98
- stack++
99
- } else if (str[i] === ')') {
100
- stack--
101
- }
102
- // 非括号内 或者 非分隔字符且非空
103
- if (stack !== 0 || (str[i] !== char && str[i] !== ' ')) {
104
- temp += str[i]
105
- }
106
- if ((stack === 0 && str[i] === char) || i === str.length - 1) {
107
- result.push(temp)
108
- temp = ''
109
- }
110
- }
111
- return result
92
+
93
+ // CSS 变量中提取 fallback 值进行验证
94
+ // 返回值:fallback | null(没有 fallback)| undefined(循环引用)
95
+ const getDefaultValueFromVar = (str, visited = new Set()) => {
96
+ const totalVarExp = /^var\((.+)\)$/
97
+ if (!totalVarExp.test(str)) return str
98
+
99
+ // 防止循环引用 - 返回 undefined 表示检测到循环
100
+ if (visited.has(str)) return undefined
101
+ visited.add(str)
102
+
103
+ const newVal = parseValues((str.match(totalVarExp)?.[1] || ''), ',')
104
+ if (newVal.length <= 1) return null // 没有 fallback
105
+ const fallback = newVal[1].trim()
106
+ // 如果 fallback 也是 var(),递归提取
107
+ if (totalVarExp.test(fallback)) return getDefaultValueFromVar(fallback, visited)
108
+ return fallback
112
109
  }
113
- // const getDefaultValueFromVar = (str) => {
114
- // const totalVarExp = /^var\((.+)\)$/
115
- // if (!totalVarExp.test(str)) return str
116
- // const newVal = parseValues((str.match(totalVarExp)?.[1] || ''), ',')
117
- // if (newVal.length <= 1) return ''
118
- // if (!totalVarExp.test(newVal[1])) return newVal[1]
119
- // return getDefaultValueFromVar(newVal[1])
120
- // }
121
- // 属性值校验
110
+
122
111
  const verifyValues = ({ prop, value, selector }, isError = true) => {
123
112
  prop = prop.trim()
124
113
  value = value.trim()
125
114
  const tips = isError ? error : warn
126
- if (cssVariableExp.test(value) || calcExp.test(value) || envExp.test(value)) return true
115
+
116
+ // 对于包含 CSS 变量的值,提取 fallback 值进行验证
117
+ if (cssVariableExp.test(value)) {
118
+ const fallback = getDefaultValueFromVar(value)
119
+ // undefined 表示检测到循环引用
120
+ if (fallback === undefined) {
121
+ tips(`CSS variable circular reference in fallback chain detected in ${selector} for property ${prop}, value: ${value}`)
122
+ return false
123
+ }
124
+ // null 表示没有 fallback,CSS 变量本身是合法的(运行时会解析)
125
+ if (fallback === null) {
126
+ return true
127
+ }
128
+ // 有 fallback 值,将 fallback 作为新的 value 继续后续验证流程
129
+ value = fallback
130
+ }
131
+
132
+ // calc() 和 env() 跳过验证
133
+ if (calcExp.test(value) || envExp.test(value)) return true
127
134
  const namedColor = ['transparent', 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen']
128
135
  const valueExp = {
129
136
  number: /^((-?(\d+(\.\d+)?|\.\d+))(rpx|px|%|vw|vh)?|hairlineWidth)$/,
@@ -393,6 +400,8 @@ module.exports = function getSpec ({ warn, error }) {
393
400
  // css var & 数组直接返回
394
401
  if (Array.isArray(value) || cssVariableExp.test(value)) return { prop, value }
395
402
  const values = parseValues(value)
403
+ // Todo transform 排序不一致时,transform动画会闪烁,故这里同样的排序输出 transform
404
+ values.sort()
396
405
  const transform = []
397
406
  values.forEach(item => {
398
407
  const match = item.match(/([/\w]+)\((.+)\)/)
@@ -540,6 +549,15 @@ module.exports = function getSpec ({ warn, error }) {
540
549
  return { prop, value: values[0].trim() }
541
550
  }
542
551
 
552
+ const formatZIndex = ({ prop, value, selector }, { mode }) => {
553
+ // z-index auto 报错
554
+ if (value === 'auto') {
555
+ error(`Property [${prop}] does not supported [${value}] on ${selector} in ${mode} environment, please check again!`)
556
+ return { prop, value: 0 }
557
+ }
558
+ return { prop, value: value }
559
+ }
560
+
543
561
  // const formatBoxShadow = ({ prop, value, selector }, { mode }) => {
544
562
  // value = value.trim()
545
563
  // if (value === 'none') {
@@ -605,6 +623,12 @@ module.exports = function getSpec ({ warn, error }) {
605
623
  android: formatFontFamily,
606
624
  harmony: formatFontFamily
607
625
  },
626
+ {
627
+ test: 'z-index',
628
+ ios: formatZIndex,
629
+ android: formatZIndex,
630
+ harmony: formatZIndex
631
+ },
608
632
  // {
609
633
  // test: 'box-shadow',
610
634
  // ios: formatBoxShadow,
@@ -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,6 +29,8 @@ 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' })
34
36
  const iosValueLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'value' })
@@ -195,10 +197,14 @@ module.exports = function ({ print }) {
195
197
  qa: qaPropLog
196
198
  },
197
199
  {
198
- test: /^(lang|from-type|hover-class|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|phone-number-no-quota-toast|bindgetuserinfo|bindcontact|createliveactivity|bindgetphonenumber|bindgetrealtimephonenumber|binderror|bindopensetting|bindlaunchapp|bindchooseavatar|bindagreeprivacyauthorization)$/,
200
+ test: /^(lang|from-type|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|phone-number-no-quota-toast|bindgetuserinfo|bindcontact|createliveactivity|bindgetphonenumber|bindgetrealtimephonenumber|binderror|bindopensetting|bindlaunchapp|bindchooseavatar|bindagreeprivacyauthorization)$/,
199
201
  ios: iosPropLog,
200
202
  android: androidPropLog,
201
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
202
208
  }
203
209
  ],
204
210
  event: [
@@ -233,10 +239,11 @@ module.exports = function ({ print }) {
233
239
  web: webEventLog
234
240
  },
235
241
  {
236
- test: /^(getuserinfo|contact|getphonenumber|bindgetrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
242
+ test: /^(getuserinfo|contact|getphonenumber|getrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
237
243
  ios: iosEventLog,
238
244
  android: androidEventLog,
239
- harmony: harmonyEventLog
245
+ harmony: harmonyEventLog,
246
+ ks: ksEventLog
240
247
  }
241
248
  ]
242
249
  }