-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy pathunsupported.js
More file actions
97 lines (94 loc) · 4.72 KB
/
unsupported.js
File metadata and controls
97 lines (94 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// 支付宝小程序不支持的标签集合
const ALI_UNSUPPORTED_TAG_NAME_ARR = ['live-pusher', 'live-player', 'audio', 'functional-page-navigator', 'editor']
// 百度小程序不支持的标签集合
const BAIDU_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'editor']
// QQ小程序不支持的标签集合
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', 'live-pusher']
// 快手小程序不支持的标签集合
const KS_UNSUPPORTED_TAG_NAME_ARR = ['match-media', 'page-container', 'root-portal', 'selection', 'functional-page-navigator', 'editor', 'editor-portal', 'keyboard-accessory', 'live-player', 'live-pusher', 'voip-room', 'channel-live', 'channel-video', 'ad-custom', 'official-account', 'official-account-publisher', 'open-data', 'store-coupon', 'store-gift', 'store-home', 'store-product']
// 京东小程序不支持的标签集合
const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'live-player', 'rich-text', 'audio', 'video', 'camera']
// 快应用不支持的标签集合
const QA_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image']
// RN不支持的标签集合
const RN_UNSUPPORTED_TAG_NAME_ARR = ['open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'audio', 'match-media', 'page-container', 'editor', 'keyboard-accessory', 'map']
/**
* @param {function(object): function} print
* @return {array}
*/
module.exports = function ({ print }) {
const aliUnsupportedTagError = print({ platform: 'ali', isError: true, type: 'tag' })
const baiduUnsupportedTagError = print({ platform: 'baidu', isError: true, type: 'tag' })
const qqUnsupportedTagError = print({ platform: 'qq', isError: true, type: 'tag' })
const ttUnsupportedTagError = print({ platform: 'bytedance', isError: true, type: 'tag' })
const ksUnsupportedTagError = print({ platform: 'ks', isError: true, type: 'tag' })
const jdUnsupportedTagError = print({ platform: 'jd', isError: true, type: 'tag' })
const qaUnsupportedTagError = print({ platform: 'qa', isError: true, type: 'tag' })
const iosUnsupportedTagError = print({ platform: 'ios', isError: true, type: 'tag' })
const androidUnsupportedTagError = print({ platform: 'android', isError: true, type: 'tag' })
const harmonyUnsupportedTagError = print({ platform: 'harmony', isError: true, type: 'tag' })
const aliUnsupportedExp = new RegExp('^(' + ALI_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const baiduUnsupportedExp = new RegExp('^(' + BAIDU_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const qqUnsupportedExp = new RegExp('^(' + QQ_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const ttUnsupportedExp = new RegExp('^(' + TT_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const ksUnsupportedExp = new RegExp('^(' + KS_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const jdUnsupportedExp = new RegExp('^(' + JD_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const qaUnsupportedExp = new RegExp('^(' + QA_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const iosUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const androidUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
const harmonyUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
return [
{
supportedModes: ['swan'],
test: baiduUnsupportedExp,
swan: baiduUnsupportedTagError
},
{
supportedModes: ['ali'],
test: aliUnsupportedExp,
ali: aliUnsupportedTagError
},
{
supportedModes: ['qq'],
test: qqUnsupportedExp,
qq: qqUnsupportedTagError
},
{
supportedModes: ['tt'],
test: ttUnsupportedExp,
tt: ttUnsupportedTagError
},
{
supportedModes: ['ks'],
test: ksUnsupportedExp,
ks: ksUnsupportedTagError
},
{
supportedModes: ['jd'],
test: jdUnsupportedExp,
jd: jdUnsupportedTagError
},
{
supportedModes: ['qa'],
test: qaUnsupportedExp,
qa: qaUnsupportedTagError
},
{
supportedModes: ['ios'],
test: iosUnsupportedExp,
ios: iosUnsupportedTagError
},
{
supportedModes: ['android'],
test: androidUnsupportedExp,
android: androidUnsupportedTagError
},
{
supportedModes: ['harmony'],
test: harmonyUnsupportedExp,
harmony: harmonyUnsupportedTagError
}
]
}