diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/ad.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/ad.js index 037e007cb5..b3fb1a18ad 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/ad.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/ad.js @@ -2,7 +2,12 @@ const TAG_NAME = 'ad' module.exports = function ({ print }) { const ttValueWarningLog = print({ platform: 'bytedance', type: 'value', tag: TAG_NAME, isError: false }) - + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const baiduValueWarningLog = print({ platform: 'baidu', type: 'value', tag: TAG_NAME, isError: false }) + const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) + const qqValueWarningLog = print({ platform: 'qq', type: 'value', tag: TAG_NAME, isError: false }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) return { test: TAG_NAME, props: [ @@ -11,10 +16,39 @@ module.exports = function ({ print }) { tt (obj) { obj.name = 'type' if (obj.value === 'grid') { - ttValueWarningLog({ name: 'type', value: 'grid' }) + ttValueWarningLog({ name: 'type', value: obj.value }) + } + return obj + }, + qq (obj) { + obj.name = 'type' + if (obj.value === 'grid' || obj.value === 'video') { + qqValueWarningLog({ name: 'type', value: obj.value }) + } + return obj + }, + swan (obj) { + obj.name = 'type' + if (obj.value === 'grid' || obj.value === 'video') { + baiduValueWarningLog({ name: 'type', value: obj.value }) } return obj } + }, + { + test: /^ad-theme$/, + tt: ttPropLog + }, + { + test: /^(ad-intervals|ad-theme)$/, + qq: qqPropLog, + swan: baiduPropLog + } + ], + event: [ + { + test: /^(close)$/, + qq: qqEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/button.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/button.js index 85d618dfa8..adc953ef95 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/button.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/button.js @@ -2,6 +2,11 @@ const { isMustache } = require('../../../../utils/string') const TAG_NAME = 'button' +// 微信支持的属性及其值 +const wxSupportPropsValue = { + 'open-type': ['contact', 'share', 'getPhoneNumber', 'getUserInfo', 'launchApp', 'openSetting', 'feedback'] +} + module.exports = function ({ print }) { const aliValueLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'value' }) const aliValueLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'value' }) @@ -11,6 +16,8 @@ module.exports = function ({ print }) { const baiduValueLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'value' }) const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) + const qqValueLogError = print({ platform: 'qq', tag: TAG_NAME, isError: true, type: 'value' }) + const qqValueLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'value' }) const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) @@ -19,6 +26,7 @@ module.exports = function ({ print }) { const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' }) + const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' }) return { test: TAG_NAME, web (tag, { el }) { @@ -60,7 +68,10 @@ module.exports = function ({ print }) { } }, swan ({ name, value }) { - const supportList = ['contact', 'share', 'getUserInfo', 'getPhoneNumber', 'openSetting'] + const supportList = ['contact', 'share', 'getUserInfo', 'getPhoneNumber', 'openSetting', 'chooseAddress', 'chooseInvoiceTitle', 'login'] + if (wxSupportPropsValue[name] && wxSupportPropsValue[name].indexOf(value) === -1) { + wxPropValueLog({ name, value }) + } if (isMustache(value)) { // 如果是个变量,报warning baiduValueLog({ name, value }) @@ -68,11 +79,26 @@ module.exports = function ({ print }) { baiduValueLogError({ name, value }) } }, + qq ({ name, value }) { + const supportList = ['share', 'getUserInfo', 'launchApp', 'openSetting', 'contact', 'feedback', 'openGroupProfile', 'addFriend', 'addColorSign', 'openPublicProfile', 'addGroupApp', 'shareMessageToFriend', 'addToFavorites'] + if (wxSupportPropsValue[name] && wxSupportPropsValue[name].indexOf(value) === -1) { + wxPropValueLog({ name, value }) + } + if (isMustache(value)) { + // 如果是个变量,报warning + qqValueLog({ name, value }) + } else if (supportList.indexOf(value) === -1) { + qqValueLogError({ name, value }) + } + }, tt ({ name, value }) { + if (wxSupportPropsValue[name] && wxSupportPropsValue[name].indexOf(value) === -1) { + wxPropValueLog({ name, value }) + } if (isMustache(value)) { ttValueLog({ name, value }) } else { - const supportList = ['share', 'getPhoneNumber'] + const supportList = ['share', 'getPhoneNumber', 'contact'] if (supportList.indexOf(value) === -1) { ttValueLogError({ name, value }) } @@ -109,7 +135,7 @@ module.exports = function ({ print }) { ], event: [ { - test: /^(getphonenumber|getuserinfo)/, + test: /^(getphonenumber|getuserinfo)$/, ali () { return 'getAuthorize' } @@ -123,12 +149,15 @@ module.exports = function ({ print }) { swan: baiduEventLog }, { - test: /^(contact)$/, + test: /^(getphonenumber)$/, qq: qqEventLog }, { - test: /^(getuserinfo|contact|getphonenumbe|error|launchapp|opensetting)$/, - tt: ttEventLog, + test: /^(getuserinfo|contact|error|launchapp|opensetting)$/, + tt: ttEventLog + }, + { + test: /^(getuserinfo|contact|error|launchapp|opensetting|getphonenumber)$/, web: webEventLog } ] diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/camera.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/camera.js index ce33374189..65a139ceb0 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/camera.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/camera.js @@ -1,9 +1,16 @@ +const { isMustache } = require('../../../../utils/string') + const TAG_NAME = 'camera' module.exports = function ({ print }) { + const ttValueLogError = print({ platform: 'bytedance', tag: TAG_NAME, isError: true, type: 'value' }) + const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) const baiduValueLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'value' }) const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) - + const qqValueLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'value' }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) return { test: TAG_NAME, props: [ @@ -15,13 +22,39 @@ module.exports = function ({ print }) { baiduValueLogError({ name, value }) } return false + }, + tt ({ name, value }) { + if (value !== 'normal') { + ttValueLogError({ name, value }) + } + return false } + }, + { + test: 'flash', + qq ({ name, value }) { + const supportList = ['auto', 'on', 'off'] + if (isMustache(value) || supportList.indexOf(value) === -1) { + // 如果是个变量,或者是不支持的属性值,报warning + qqValueLog({ name, value }) + } + }, + tt: ttPropLog + }, + { + test: /^(resolution|frame-size)$/, + qq: qqPropLog } ], event: [ { test: /^(scancode)$/, - swan: baiduEventLog + swan: baiduEventLog, + tt: ttEventLog + }, + { + test: /^(initdone)$/, + qq: qqEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/canvas.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/canvas.js index 601c14547d..f0ab45c402 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/canvas.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/canvas.js @@ -3,6 +3,7 @@ const TAG_NAME = 'canvas' module.exports = function ({ print }) { const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) return { test: TAG_NAME, props: [ @@ -40,6 +41,10 @@ module.exports = function ({ print }) { { test: /^(error)$/, ali: aliEventLog + }, + { + test: /^(longtap|error)$/, + tt: ttEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/cover-view.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/cover-view.js index d82cead692..c80a1fbcc9 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/cover-view.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/cover-view.js @@ -2,9 +2,8 @@ const TAG_NAME = 'cover-view' module.exports = function ({ print }) { const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) - const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) + const baiduValueLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'value' }) const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) - return { test: TAG_NAME, web (tag, { el }) { @@ -21,7 +20,11 @@ module.exports = function ({ print }) { { test: 'scroll-top', ali: aliPropLog, - swan: baiduPropLog, + swan ({ name, value }) { + if (typeof value === 'string') { + baiduValueLogError({ name, value }) + } + }, web: webPropLog }, { diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/index.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/index.js index 0fe84e0dad..cb54c8caba 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/index.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/index.js @@ -1,40 +1,43 @@ const ad = require('./ad') -const view = require('./view') -const scrollView = require('./scroll-view') -const swiper = require('./swiper') -const swiperItem = require('./swiper-item') -const movableView = require('./movable-view') -const movableArea = require('./movable-area') -const coverView = require('./cover-view') -const coverImage = require('./cover-image') -const text = require('./text') -const richText = require('./rich-text') -const progress = require('./progress') +const block = require('./block') const button = require('./button') +const camera = require('./camera') +const canvas = require('./canvas') const checkboxGroup = require('./checkbox-group') const checkbox = require('./checkbox') -const radioGroup = require('./radio-group') -const radio = require('./radio') +const coverImage = require('./cover-image') +const coverView = require('./cover-view') const form = require('./form') +const HyphenTagName = require('./hypen-tag-name') +const icon = require('./icon') +const image = require('./image') const input = require('./input') -const picker = require('./picker') -const pickerView = require('./picker-view') +const livePlayer = require('./live-player') +const livePusher = require('./live-pusher') +const map = require('./map') +const movableArea = require('./movable-area') +const movableView = require('./movable-view') +const navigator = require('./navigator') const pickerViewColumn = require('./picker-view-column') +const pickerView = require('./picker-view') +const picker = require('./picker') +const progress = require('./progress') +const radioGroup = require('./radio-group') +const radio = require('./radio') +const richText = require('./rich-text') +const scrollView = require('./scroll-view') const slider = require('./slider') +const swiperItem = require('./swiper-item') +const swiper = require('./swiper') const switchComponent = require('./switch') -const textarea = require('./textarea') -const navigator = require('./navigator') -const image = require('./image') -const map = require('./map') -const canvas = require('./canvas') -const wxs = require('./wxs') const template = require('./template') -const block = require('./block') -const icon = require('./icon') +const text = require('./text') +const textarea = require('./textarea') const Nonsupport = require('./unsupported') -const HyphenTagName = require('./hypen-tag-name') -const webView = require('./web-view') const video = require('./video') +const view = require('./view') +const webView = require('./web-view') +const wxs = require('./wxs') module.exports = function getComponentConfigs ({ warn, error }) { /** @@ -64,6 +67,9 @@ module.exports = function getComponentConfigs ({ warn, error }) { case 'tagRequiredProps': msg = `<${tag}> should have '${arg}' attr in ali environment!` break + case 'value-attr-uniform': + msg = `The internal attribute name of the <${tag}>'s attribute '${arg && arg.value}' is not supported in the ali environment, Please check!` + break default: msg = `<${tag}>'s transform has some error happened!` } @@ -106,8 +112,11 @@ module.exports = function getComponentConfigs ({ warn, error }) { template(), block(), icon(), - HyphenTagName({ print }), webView({ print }), - video({ print }) + video({ print }), + camera({ print }), + livePlayer({ print }), + livePusher({ print }), + HyphenTagName({ print }) ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/live-player.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/live-player.js index 734d9fb710..31b764f53c 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/live-player.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/live-player.js @@ -3,7 +3,11 @@ const TAG_NAME = 'live-player' module.exports = function ({ print }) { const baiduValueLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'value' }) const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) - + const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'event' }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) + const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, props: [ @@ -20,6 +24,25 @@ module.exports = function ({ print }) { { test: /^(sound-mode|auto-pause-if-navigate|auto-pause-if-open-native)$/, swan: baiduPropLog + }, + { + test: /^(background-mute|picture-in-picture-mode)$/, + qq: qqPropLog + }, + { + test: /^(mode|background-mute|min-cache|max-cache|sound-mode|auto-pause-if-navigate|auto-pause-if-open-native)$/, + tt: ttPropLog + } + ], + event: [ + { + test: /^(audiovolumenotify|enterpictureinpicture|leavepictureinpicture)$/, + qq: qqEventLog, + swan: baiduEventLog + }, + { + test: /^(netstatus|audiovolumenotify|enterpictureinpicture|leavepictureinpicture)$/, + tt: ttEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/live-pusher.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/live-pusher.js new file mode 100644 index 0000000000..960b15389e --- /dev/null +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/live-pusher.js @@ -0,0 +1,21 @@ +const TAG_NAME = 'live-pusher' + +module.exports = function ({ print }) { + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) + return { + test: TAG_NAME, + props: [ + { + test: /^(remote-mirror|local-mirror|audio-reverb-type|enable-mic|enable-agc|enable-ans|audio-volume-type|video-width|video-height|beauty-style|filter)$/, + qq: qqPropLog + } + ], + event: [ + { + test: /^(audiovolumenotify)$/, + qq: qqEventLog + } + ] + } +} diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/map.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/map.js index 37cda6c5e7..6a608f0693 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/map.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/map.js @@ -3,21 +3,36 @@ const TAG_NAME = 'map' module.exports = function ({ print }) { const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) const aliEventLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'event' }) + const aliPropValueWarningLog = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'value-attr-uniform' }) const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) const baiduEventLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'event' }) - + const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) return { // 匹配标签名,可传递正则 test: TAG_NAME, // 组件属性中的差异部分 props: [ { - test: /^(covers|subkey|enable-3D|show-compass|enable-overlooking|enable-zoom|disable-scroll|enable-rotate)$/, + test: /^(min-scale|max-scale|covers|subkey|layer-style|rotate|skew|enable-3D|show-compass|show-scale|enable-overlooking|enable-zoom|enable-scroll|enable-rotate|enable-satellite|enable-traffic|enable-poi|enable-building)$/, ali: aliPropLog }, + { + test: /^polygons$/, + ali ({ name, value }) { + name = 'polygon' + // TODO 标签的属性名不一致,后续考虑通过wxs注入的方式实现转换 + aliPropValueWarningLog() + return { name, value } + } + }, { test: 'subkey', swan: baiduPropLog + }, + { + test: /^(min-scale|max-scale|polyline|controls|polygons|subkey|layer-style|rotate|skew|enable-3D|show-compass|show-scale|enable-overlooking|enable-zoom|enable-scroll|enable-rotate|enable-satellite|enable-traffic|enable-poi|enable-building|setting)$/, + tt: ttPropLog } ], // 组件事件中的差异部分 @@ -38,12 +53,16 @@ module.exports = function ({ print }) { } }, { - test: /^(updated|poitap)$/, + test: /^(updated|poitap|anchorpointtap)$/, ali: aliEventLogError }, { test: 'poitap', swan: baiduEventLogError + }, + { + test: /^(labeltap|controltap|updated|regionchange|poitap|anchorpointtap)$/, + tt: ttEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-area.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-area.js index 2410dc47da..4593c2f435 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-area.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-area.js @@ -1,18 +1,11 @@ const TAG_NAME = 'movable-area' module.exports = function ({ print }) { - const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { el.isBuiltIn = true return 'mpx-movable-area' - }, - props: [ - { - test: /^(scale-area)$/, - ali: aliPropLog - } - ] + } } } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-view.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-view.js index 2a2e23b374..569a3d5375 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-view.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/movable-view.js @@ -1,7 +1,6 @@ const TAG_NAME = 'movable-view' module.exports = function ({ print }) { - const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) return { test: TAG_NAME, @@ -9,24 +8,9 @@ module.exports = function ({ print }) { el.isBuiltIn = true return 'mpx-movable-view' }, - props: [ - { - test: /^(inertia|out-of-bounds|damping|friction|scale|scale-min|scale-max|scale-value|animation|htouchmove|vtouchmove)$/, - ali: aliPropLog - } - ], event: [ { - test: /^(change)$/, - ali (eventName) { - const eventMap = { - 'change': 'change' - } - return eventMap[eventName] - } - }, - { - test: /^(scale)$/, + test: /^(htouchmove|vtouchmove)$/, ali: aliEventLog } ] diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/navigator.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/navigator.js index acd374b45f..931e3721c2 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/navigator.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/navigator.js @@ -2,17 +2,23 @@ const { isMustache } = require('../../../../utils/string') const TAG_NAME = 'navigator' +// 微信支持的属性及其值 +const wxSupportPropsValue = { + 'open-type': ['navigate', 'redirect', 'switchTab', 'reLaunch', 'navigateBack', 'exit'] +} + module.exports = function ({ print }) { const aliValueLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true, type: 'value' }) const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) const aliPropLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true }) const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) + const ttValueLogError = print({ platform: 'bytedance', tag: TAG_NAME, isError: true, type: 'value' }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) const webValueLogError = print({ platform: 'web', tag: TAG_NAME, isError: true, type: 'value' }) - + const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' }) return { test: TAG_NAME, web (tag, { el }) { @@ -27,6 +33,9 @@ module.exports = function ({ print }) { { test: 'open-type', ali (attr) { + if (wxSupportPropsValue[attr.name] && wxSupportPropsValue[attr.name].indexOf(attr.value) === -1) { + wxPropValueLog({ name: attr.name, value: attr.value }) + } if (isMustache(attr.value)) { // 如果是个变量,报warning~ aliPropLog(attr) @@ -37,6 +46,20 @@ module.exports = function ({ print }) { } } }, + tt (attr) { + if (wxSupportPropsValue[attr.name] && wxSupportPropsValue[attr.name].indexOf(attr.value) === -1) { + wxPropValueLog({ name: attr.name, value: attr.value }) + } + if (isMustache(attr.value)) { + // 如果是个变量,报warning~ + ttPropLog(attr) + } else { + let supportedList = ['navigate', 'redirect', 'switchTab', 'navigateBack', 'reLaunch'] + if (supportedList.indexOf(attr.value) === -1) { + ttValueLogError(attr) + } + } + }, web (attr) { let supportedList = ['navigate', 'redirect', 'navigateBack', 'reLaunch'] if (supportedList.indexOf(attr.value) === -1) { @@ -44,10 +67,6 @@ module.exports = function ({ print }) { } } }, - { - test: /^(hover-stop-propagation)$/, - ali: aliPropLog - }, { test: /^(target|app-id|path|extra-data|version)$/, tt: ttPropLog diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/picker-view.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/picker-view.js index 4a840bf719..8f182d21d4 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/picker-view.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/picker-view.js @@ -5,7 +5,6 @@ module.exports = function ({ print }) { const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) - return { test: TAG_NAME, web (tag, { el }) { @@ -19,15 +18,6 @@ module.exports = function ({ print }) { } ], event: [ - { - test: /^(change)$/, - ali (eventName) { - const eventMap = { - 'change': 'change' - } - return eventMap[eventName] - } - }, { test: /^(pickstart|pickend)$/, ali: aliEventLog, diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/picker.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/picker.js index dabf2d995c..5ede9a5c9e 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/picker.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/picker.js @@ -2,7 +2,10 @@ const TAG_NAME = 'picker' module.exports = function ({ print }) { const aliPropLogError = print({ platform: 'ali', tag: TAG_NAME, isError: true }) + const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -18,18 +21,15 @@ module.exports = function ({ print }) { } return false } + }, + { + test: /^(header-text)$/, + tt: ttPropLog, + swan: baiduPropLog, + ali: aliPropLog } ], event: [ - { - test: /^(change)$/, - ali (eventName) { - const eventMap = { - 'change': 'change' - } - return eventMap[eventName] - } - }, { test: /^(cancel)$/, ali: aliEventLog diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/progress.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/progress.js index 6884ecf0c3..90b9e6765c 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/progress.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/progress.js @@ -7,7 +7,7 @@ module.exports = function ({ print }) { const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'event' }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) - + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -16,7 +16,7 @@ module.exports = function ({ print }) { }, props: [ { - test: /^(border-radius|font-size|color|active-mode)$/, + test: /^(border-radius|font-size|color|active-mode|duration)$/, ali: aliPropLog }, { @@ -43,8 +43,12 @@ module.exports = function ({ print }) { } }, { - test: /^(show-info|border-radius|font-size|)$/, + test: /^(show-info|border-radius|font-size|duration)$/, tt: ttPropLog + }, + { + test: /^(duration)$/, + qq: qqPropLog } ], event: [ diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/scroll-view.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/scroll-view.js index c1e27b822a..fff56b02f8 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/scroll-view.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/scroll-view.js @@ -2,8 +2,13 @@ const TAG_NAME = 'scroll-view' module.exports = function ({ print }) { const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) + const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'event' }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) - + const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) + const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) + const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -11,6 +16,13 @@ module.exports = function ({ print }) { return 'mpx-scroll-view' }, props: [ + { + test: /^(enable-flex|scroll-anchorin|refresher-enabled|refresher-threshold|refresher-default-style|refresher-background|refresher-triggered|enhanced|bounces|show-scrollbar|paging-enabled|fast-deceleratio)$/, + ali: aliPropLog, + tt: ttPropLog, + qq: qqPropLog, + swan: baiduPropLog + }, { test: /^(enable-back-to-top)$/, swan: baiduPropLog, @@ -28,6 +40,13 @@ module.exports = function ({ print }) { } return eventMap[eventName] } + }, + { + test: /^(dragstart|dragging|dragend|refresherpulling|refresherrefresh|refresherrestore|refresherabort)$/, + ali: aliEventLog, + tt: ttEventLog, + qq: qqEventLog, + swan: baiduEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/slider.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/slider.js index eb1d3549f2..c93d0b4468 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/slider.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/slider.js @@ -50,18 +50,6 @@ module.exports = function ({ print }) { return obj } } - ], - event: [ - { - test: /^(change)$/, - ali (eventName) { - const eventMap = { - 'change': 'change', - 'changing': 'changing' - } - return eventMap[eventName] - } - } ] } } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper-item.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper-item.js index 876e09fa52..0b59d66fbb 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper-item.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper-item.js @@ -2,6 +2,9 @@ const TAG_NAME = 'swiper-item' module.exports = function ({ print }) { const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -12,6 +15,13 @@ module.exports = function ({ print }) { { test: /^(item-id)$/, ali: aliPropLog + }, + { + test: /^(skip-hidden-item-layout)$/, + ali: aliPropLog, + tt: ttPropLog, + swan: baiduPropLog, + qq: qqPropLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper.js index a5d5b8a0b2..81d4515d56 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/swiper.js @@ -2,14 +2,11 @@ const TAG_NAME = 'swiper' module.exports = function ({ print }) { const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) - const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'event' }) const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) - const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) - return { test: TAG_NAME, web (tag, { el }) { @@ -22,15 +19,15 @@ module.exports = function ({ print }) { ali: aliPropLog }, { - test: /^(skip-hidden-item-layout|easing-function)$/, + test: /^(skip-hidden-item-layout|easing-function|snap-to-edge)$/, swan: baiduPropLog }, { - test: /^(easing-function)$/, + test: /^(easing-function|snap-to-edge)$/, qq: qqPropLog }, { - test: /^(previous-margin|next-margin|skip-hidden-item-layout|easing-function)$/, + test: /^(skip-hidden-item-layout|easing-function)$/, tt: ttPropLog }, { @@ -40,19 +37,15 @@ module.exports = function ({ print }) { ], event: [ { - test: /^(change)$/, + test: /^(change|animationfinish)$/, ali (eventName) { const eventMap = { - 'change': 'change' + 'change': 'change', + 'animationfinish': 'animationEnd' } return eventMap[eventName] } }, - { - test: /^(transition|animationfinish)$/, - ali: aliEventLog, - tt: ttEventLog - }, { test: /^(transition)$/, swan: baiduEventLog diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/switch.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/switch.js index 6d731c2c8a..790e5cdb2f 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/switch.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/switch.js @@ -2,9 +2,6 @@ const TAG_NAME = 'switch' module.exports = function ({ print }) { const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) - const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' }) - const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) - return { test: TAG_NAME, web (tag, { el }) { @@ -15,25 +12,6 @@ module.exports = function ({ print }) { { test: /^type$/, ali: aliPropLog - }, - { - test: /^disabled$/, - tt: ttPropLog - } - ], - event: [ - { - test: /^(change)$/, - ali (eventName) { - const eventMap = { - 'change': 'change' - } - return eventMap[eventName] - } - }, - { - test: /^(linechange|animationfinish)$/, - ali: aliEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/text.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/text.js index 6676c5a3ab..6d23b0b9ba 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/text.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/text.js @@ -2,7 +2,9 @@ const TAG_NAME = 'text' module.exports = function ({ print }) { const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) - + const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false }) + const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -17,9 +19,15 @@ module.exports = function ({ print }) { }, props: [ { - test: /^(decode)$/, + test: /^(decode|user-select)$/, swan: baiduPropLog }, + { + test: /^(user-select)$/, + ali: aliPropLog, + tt: ttPropLog, + qq: qqPropLog + }, { test: /^(selectable|space|decode|use-built-in)$/, web (prop, { el }) { diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/textarea.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/textarea.js index 7c8329dbba..fca5edff7d 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/textarea.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/textarea.js @@ -7,7 +7,9 @@ module.exports = function ({ print }) { const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' }) const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false }) const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' }) - + const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' }) + const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false }) + const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false }) return { test: TAG_NAME, web (tag, { el }) { @@ -17,11 +19,16 @@ module.exports = function ({ print }) { }, props: [ { - test: /^(auto-focus|fixed|cursor-spacing|cursor|show-confirm-bar|selection-start|selection-end|adjust-position)$/, + test: /^(auto-focus|fixed|cursor-spacing|cursor|show-confirm-bar|selection-start|selection-end|adjust-position|hold-keyboard|disable-default-padding|confirm-type)$/, ali: aliPropLog }, { - test: /^(placeholder-class|auto-focus|show-confirm-bar|adjust-position)$/, + test: /^(hold-keyboard|disable-default-padding|confirm-type)$/, + qq: qqPropLog, + swan: baiduPropLog + }, + { + test: /^(placeholder-class|auto-focus|show-confirm-bar|adjust-position|hold-keyboard|disable-default-padding|confirm-type)$/, tt: ttPropLog }, { @@ -31,26 +38,17 @@ module.exports = function ({ print }) { ], event: [ { - test: /^(focus|blur|input|confirm)$/, - ali (eventName) { - const eventMap = { - 'blur': 'blur', - 'focus': 'focus', - 'input': 'input', - 'confirm': 'confirm' - } - return eventMap[eventName] - } + test: /^(confirm|linechange)$/, + web: webEventLog }, { - test: 'linechange', + test: /^keyboardheightchange$/, ali: aliEventLog, - tt: ttEventLog, - web: webEventLog + qq: qqEventLog }, { - test: 'confirm', - web: webEventLog + test: /^(linechange|keyboardheightchange)$/, + tt: ttEventLog } ] } diff --git a/packages/webpack-plugin/lib/platform/template/wx/component-config/unsupported.js b/packages/webpack-plugin/lib/platform/template/wx/component-config/unsupported.js index 2af0a42a10..24db9ea0b8 100644 --- a/packages/webpack-plugin/lib/platform/template/wx/component-config/unsupported.js +++ b/packages/webpack-plugin/lib/platform/template/wx/component-config/unsupported.js @@ -3,9 +3,9 @@ const ALI_UNSUPPORTED_TAG_NAME_ARR = ['live-pusher', 'live-player', 'audio', 'fu // 百度小程序不支持的标签集合 const BAIDU_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'editor'] // QQ小程序不支持的标签集合 -const QQ_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-player', 'live-pusher', 'map', 'official-account', 'editor'] +const QQ_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'official-account', 'editor'] // 头条小程序不支持的标签集合 -const TT_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'cover-image', 'cover-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'audio', 'camera', 'live-player', 'live-pusher'] +const TT_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'cover-image', 'cover-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'audio', 'live-pusher'] /** * @param {function(object): function} print