@mpxjs/webpack-plugin 2.9.39 → 2.9.41-react.0
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.
- package/lib/config.js +63 -97
- package/lib/dependencies/{RecordVueContentDependency.js → RecordLoaderContentDependency.js} +5 -5
- package/lib/dependencies/ResolveDependency.js +2 -2
- package/lib/helpers.js +5 -1
- package/lib/index.js +26 -21
- package/lib/loader.js +43 -97
- package/lib/native-loader.js +0 -1
- package/lib/platform/index.js +3 -0
- package/lib/platform/style/wx/index.js +414 -0
- package/lib/platform/template/wx/component-config/button.js +36 -0
- package/lib/platform/template/wx/component-config/image.js +15 -0
- package/lib/platform/template/wx/component-config/input.js +41 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +27 -1
- package/lib/platform/template/wx/component-config/swiper-item.js +13 -1
- package/lib/platform/template/wx/component-config/swiper.js +25 -1
- package/lib/platform/template/wx/component-config/text.js +15 -0
- package/lib/platform/template/wx/component-config/textarea.js +39 -0
- package/lib/platform/template/wx/component-config/unsupported.js +18 -0
- package/lib/platform/template/wx/component-config/view.js +14 -0
- package/lib/platform/template/wx/index.js +88 -4
- package/lib/react/index.js +104 -0
- package/lib/react/processJSON.js +361 -0
- package/lib/react/processMainScript.js +21 -0
- package/lib/react/processScript.js +70 -0
- package/lib/react/processStyles.js +69 -0
- package/lib/react/processTemplate.js +153 -0
- package/lib/react/script-helper.js +133 -0
- package/lib/react/style-helper.js +91 -0
- package/lib/resolver/PackageEntryPlugin.js +1 -0
- package/lib/runtime/components/react/event.config.ts +32 -0
- package/lib/runtime/components/react/getInnerListeners.ts +289 -0
- package/lib/runtime/components/react/getInnerListeners.type.ts +68 -0
- package/lib/runtime/components/react/mpx-button.tsx +402 -0
- package/lib/runtime/components/react/mpx-image/index.tsx +351 -0
- package/lib/runtime/components/react/mpx-image/svg.tsx +21 -0
- package/lib/runtime/components/react/mpx-input.tsx +389 -0
- package/lib/runtime/components/react/mpx-scroll-view.tsx +412 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +398 -0
- package/lib/runtime/components/react/mpx-swiper/index.tsx +68 -0
- package/lib/runtime/components/react/mpx-swiper/type.ts +69 -0
- package/lib/runtime/components/react/mpx-swiper-item.tsx +42 -0
- package/lib/runtime/components/react/mpx-text.tsx +106 -0
- package/lib/runtime/components/react/mpx-textarea.tsx +46 -0
- package/lib/runtime/components/react/mpx-view.tsx +397 -0
- package/lib/runtime/components/react/useNodesRef.ts +39 -0
- package/lib/runtime/components/react/utils.ts +92 -0
- package/lib/runtime/optionProcessorReact.d.ts +9 -0
- package/lib/runtime/optionProcessorReact.js +21 -0
- package/lib/runtime/stringify.wxs +3 -8
- package/lib/style-compiler/index.js +2 -1
- package/lib/template-compiler/compiler.js +293 -38
- package/lib/template-compiler/gen-node-react.js +95 -0
- package/lib/template-compiler/index.js +15 -24
- package/lib/utils/env.js +17 -0
- package/lib/utils/make-map.js +1 -1
- package/lib/utils/shallow-stringify.js +12 -12
- package/lib/web/index.js +123 -0
- package/lib/web/processJSON.js +3 -3
- package/lib/web/processMainScript.js +25 -23
- package/lib/web/processScript.js +12 -16
- package/lib/web/processTemplate.js +13 -12
- package/lib/web/script-helper.js +14 -22
- package/package.json +4 -3
|
@@ -6,6 +6,8 @@ module.exports = function ({ print }) {
|
|
|
6
6
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
7
7
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
8
8
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
9
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
test: TAG_NAME,
|
|
@@ -13,6 +15,14 @@ module.exports = function ({ print }) {
|
|
|
13
15
|
el.isBuiltIn = true
|
|
14
16
|
return 'mpx-image'
|
|
15
17
|
},
|
|
18
|
+
ios (tag, { el }) {
|
|
19
|
+
el.isBuiltIn = true
|
|
20
|
+
return 'mpx-image'
|
|
21
|
+
},
|
|
22
|
+
android (tag, { el }) {
|
|
23
|
+
el.isBuiltIn = true
|
|
24
|
+
return 'mpx-image'
|
|
25
|
+
},
|
|
16
26
|
props: [
|
|
17
27
|
{
|
|
18
28
|
test: /^show-menu-by-longpress$/,
|
|
@@ -34,6 +44,11 @@ module.exports = function ({ print }) {
|
|
|
34
44
|
{
|
|
35
45
|
test: /^(show-menu-by-longpress|webp)$/,
|
|
36
46
|
qa: qaPropLog
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
test: /^(show-menu-by-longpress|fade-in)$/,
|
|
50
|
+
ios: iosPropLog,
|
|
51
|
+
android: androidPropLog
|
|
37
52
|
}
|
|
38
53
|
]
|
|
39
54
|
}
|
|
@@ -5,6 +5,7 @@ module.exports = function ({ print }) {
|
|
|
5
5
|
const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
|
|
6
6
|
const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
|
|
7
7
|
const baiduEventLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false, type: 'event' })
|
|
8
|
+
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
8
9
|
const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
|
|
9
10
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
10
11
|
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
@@ -12,6 +13,12 @@ module.exports = function ({ print }) {
|
|
|
12
13
|
const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
14
|
const webValueLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'value' })
|
|
14
15
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
16
|
+
const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
|
|
17
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
18
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
19
|
+
const androidValueLogError = print({ platform: 'android', tag: TAG_NAME, isError: true, type: 'value' })
|
|
20
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
21
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
22
|
|
|
16
23
|
return {
|
|
17
24
|
test: TAG_NAME,
|
|
@@ -19,6 +26,14 @@ module.exports = function ({ print }) {
|
|
|
19
26
|
el.isBuiltIn = true
|
|
20
27
|
return 'mpx-input'
|
|
21
28
|
},
|
|
29
|
+
ios (tag, { el }) {
|
|
30
|
+
el.isBuiltIn = true
|
|
31
|
+
return 'mpx-input'
|
|
32
|
+
},
|
|
33
|
+
android (tag, { el }) {
|
|
34
|
+
el.isBuiltIn = true
|
|
35
|
+
return 'mpx-input'
|
|
36
|
+
},
|
|
22
37
|
props: [
|
|
23
38
|
{
|
|
24
39
|
test: /^(cursor-spacing|auto-focus|adjust-position|hold-keyboard)$/,
|
|
@@ -28,6 +43,10 @@ module.exports = function ({ print }) {
|
|
|
28
43
|
test: /^(auto-focus|hold-keyboard)$/,
|
|
29
44
|
swan: baiduPropLog
|
|
30
45
|
},
|
|
46
|
+
{
|
|
47
|
+
test: /^(placeholder-class|auto-focus|confirm-type|confirm-hold|adjust-position|hold-keyboard)$/,
|
|
48
|
+
tt: ttPropLog
|
|
49
|
+
},
|
|
31
50
|
{
|
|
32
51
|
test: /^(hold-keyboard)$/,
|
|
33
52
|
jd: jdPropLog
|
|
@@ -44,6 +63,18 @@ module.exports = function ({ print }) {
|
|
|
44
63
|
name,
|
|
45
64
|
value
|
|
46
65
|
}
|
|
66
|
+
},
|
|
67
|
+
ios ({ name, value }) {
|
|
68
|
+
const notSupported = ['safe-password', 'nickname']
|
|
69
|
+
if (notSupported.includes(value)) {
|
|
70
|
+
iosValueLogError({ name, value })
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
android ({ name, value }) {
|
|
74
|
+
const notSupported = ['safe-password', 'nickname']
|
|
75
|
+
if (notSupported.includes(value)) {
|
|
76
|
+
androidValueLogError({ name, value })
|
|
77
|
+
}
|
|
47
78
|
}
|
|
48
79
|
},
|
|
49
80
|
{
|
|
@@ -59,6 +90,11 @@ module.exports = function ({ print }) {
|
|
|
59
90
|
{
|
|
60
91
|
test: /^(always-embed|bindkeyboardheightchange)$/,
|
|
61
92
|
qa: qaPropLog
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
test: /^(placeholder-style|placeholder-class|cursor-spacing|always-embed|adjust-position|hold-keyboard|safe-password-.+)$/,
|
|
96
|
+
ios: iosPropLog,
|
|
97
|
+
android: androidPropLog
|
|
62
98
|
}
|
|
63
99
|
],
|
|
64
100
|
event: [
|
|
@@ -73,6 +109,11 @@ module.exports = function ({ print }) {
|
|
|
73
109
|
{
|
|
74
110
|
test: 'confirm',
|
|
75
111
|
web: webEventLog
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
test: /^(nicknamereview|onkeyboardheightchange|keyboard.+)$/,
|
|
115
|
+
ios: iosEventLog,
|
|
116
|
+
android: androidEventLog
|
|
76
117
|
}
|
|
77
118
|
]
|
|
78
119
|
}
|
|
@@ -12,6 +12,10 @@ module.exports = function ({ print }) {
|
|
|
12
12
|
const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
13
|
const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
|
|
14
14
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
15
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
16
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
17
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
15
19
|
|
|
16
20
|
return {
|
|
17
21
|
test: TAG_NAME,
|
|
@@ -19,9 +23,17 @@ module.exports = function ({ print }) {
|
|
|
19
23
|
el.isBuiltIn = true
|
|
20
24
|
return 'mpx-scroll-view'
|
|
21
25
|
},
|
|
26
|
+
android (tag, { el }) {
|
|
27
|
+
el.isBuiltIn = true
|
|
28
|
+
return 'mpx-scroll-view'
|
|
29
|
+
},
|
|
30
|
+
ios (tag, { el }) {
|
|
31
|
+
el.isBuiltIn = true
|
|
32
|
+
return 'mpx-scroll-view'
|
|
33
|
+
},
|
|
22
34
|
props: [
|
|
23
35
|
{
|
|
24
|
-
test: /^(enable-flex|scroll-
|
|
36
|
+
test: /^(enable-flex|scroll-anchoring|refresher-enabled|refresher-threshold|refresher-default-style|refresher-background|refresher-triggered|enhanced|bounces|show-scrollbar|paging-enabled|fast-deceleration)$/,
|
|
25
37
|
ali: aliPropLog,
|
|
26
38
|
tt: ttPropLog,
|
|
27
39
|
qq: qqPropLog,
|
|
@@ -39,6 +51,15 @@ module.exports = function ({ print }) {
|
|
|
39
51
|
{
|
|
40
52
|
test: /^(enable-back-to-top|enable-flex|scroll-anchoring|enhanced|bounces|show-scrollbar|paging-enabled|fast-deceleration|binddragstart|binddragging|binddragend)$/,
|
|
41
53
|
qa: qaPropLog
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
test: /^(scroll-into-view|refresher-threshold|enable-passive|scroll-anchoring|using-sticky|fast-deceleration|enable-flex)$/,
|
|
57
|
+
android: androidPropLog,
|
|
58
|
+
ios: iosPropLog
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
test: /^(refresher-default-style|refresher-background)$/,
|
|
62
|
+
ios: iosPropLog
|
|
42
63
|
}
|
|
43
64
|
],
|
|
44
65
|
event: [
|
|
@@ -63,6 +84,11 @@ module.exports = function ({ print }) {
|
|
|
63
84
|
tt: ttEventLog,
|
|
64
85
|
qq: qqEventLog,
|
|
65
86
|
swan: baiduEventLog
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
test: /^(refresherpulling|refresherrestore|refresherabort)$/,
|
|
90
|
+
android: androidEventLog,
|
|
91
|
+
ios: iosEventLog
|
|
66
92
|
}
|
|
67
93
|
]
|
|
68
94
|
}
|
|
@@ -6,6 +6,8 @@ module.exports = function ({ print }) {
|
|
|
6
6
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
7
7
|
const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
|
|
8
8
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
9
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
test: TAG_NAME,
|
|
@@ -13,10 +15,20 @@ module.exports = function ({ print }) {
|
|
|
13
15
|
el.isBuiltIn = true
|
|
14
16
|
return 'mpx-swiper-item'
|
|
15
17
|
},
|
|
18
|
+
ios (tag, { el }) {
|
|
19
|
+
el.isBuiltIn = true
|
|
20
|
+
return 'mpx-swiper-item'
|
|
21
|
+
},
|
|
22
|
+
android (tag, { el }) {
|
|
23
|
+
el.isBuiltIn = true
|
|
24
|
+
return 'mpx-swiper-item'
|
|
25
|
+
},
|
|
16
26
|
props: [
|
|
17
27
|
{
|
|
18
28
|
test: /^(item-id)$/,
|
|
19
|
-
ali: aliPropLog
|
|
29
|
+
ali: aliPropLog,
|
|
30
|
+
ios: iosPropLog,
|
|
31
|
+
android: androidPropLog
|
|
20
32
|
},
|
|
21
33
|
{
|
|
22
34
|
test: /^(skip-hidden-item-layout)$/,
|
|
@@ -10,6 +10,10 @@ module.exports = function ({ print }) {
|
|
|
10
10
|
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
11
11
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
12
12
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
13
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
14
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
16
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
17
|
|
|
14
18
|
return {
|
|
15
19
|
test: TAG_NAME,
|
|
@@ -17,6 +21,14 @@ module.exports = function ({ print }) {
|
|
|
17
21
|
el.isBuiltIn = true
|
|
18
22
|
return 'mpx-swiper'
|
|
19
23
|
},
|
|
24
|
+
ios (tag, { el }) {
|
|
25
|
+
el.isBuiltIn = true
|
|
26
|
+
return 'mpx-swiper'
|
|
27
|
+
},
|
|
28
|
+
android (tag, { el }) {
|
|
29
|
+
el.isBuiltIn = true
|
|
30
|
+
return 'mpx-swiper'
|
|
31
|
+
},
|
|
20
32
|
props: [
|
|
21
33
|
{
|
|
22
34
|
test: /^(display-multiple-items|skip-hidden-item-layout|easing-function)$/,
|
|
@@ -45,6 +57,11 @@ module.exports = function ({ print }) {
|
|
|
45
57
|
{
|
|
46
58
|
test: /^(snap-to-edge|easing-function)$/,
|
|
47
59
|
qa: qaPropLog
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
test: /^(display-multiple-items|snap-to-edge|easing-function)$/,
|
|
63
|
+
ios: iosPropLog,
|
|
64
|
+
android: androidPropLog
|
|
48
65
|
}
|
|
49
66
|
],
|
|
50
67
|
event: [
|
|
@@ -61,7 +78,14 @@ module.exports = function ({ print }) {
|
|
|
61
78
|
{
|
|
62
79
|
test: /^(transition)$/,
|
|
63
80
|
swan: baiduEventLog,
|
|
64
|
-
jd: jdEventLog
|
|
81
|
+
jd: jdEventLog,
|
|
82
|
+
ios: iosEventLog,
|
|
83
|
+
android: androidEventLog
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
test: /^(animationfinish)$/,
|
|
87
|
+
ios: iosEventLog,
|
|
88
|
+
android: androidEventLog
|
|
65
89
|
}
|
|
66
90
|
]
|
|
67
91
|
}
|
|
@@ -6,6 +6,8 @@ module.exports = function ({ print }) {
|
|
|
6
6
|
const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false })
|
|
7
7
|
const ttPropLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false })
|
|
8
8
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
9
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
test: TAG_NAME,
|
|
@@ -20,6 +22,14 @@ module.exports = function ({ print }) {
|
|
|
20
22
|
return 'span'
|
|
21
23
|
}
|
|
22
24
|
},
|
|
25
|
+
ios (tag, { el }) {
|
|
26
|
+
el.isBuiltIn = true
|
|
27
|
+
return 'mpx-text'
|
|
28
|
+
},
|
|
29
|
+
android (tag, { el }) {
|
|
30
|
+
el.isBuiltIn = true
|
|
31
|
+
return 'mpx-text'
|
|
32
|
+
},
|
|
23
33
|
props: [
|
|
24
34
|
{
|
|
25
35
|
test: /^(decode|user-select)$/,
|
|
@@ -32,6 +42,11 @@ module.exports = function ({ print }) {
|
|
|
32
42
|
qq: qqPropLog,
|
|
33
43
|
qa: qaPropLog
|
|
34
44
|
},
|
|
45
|
+
{
|
|
46
|
+
test: /^(space|decode)$/,
|
|
47
|
+
ios: iosPropLog,
|
|
48
|
+
android: androidPropLog
|
|
49
|
+
},
|
|
35
50
|
{
|
|
36
51
|
test: /^(selectable|space|decode|use-built-in)$/,
|
|
37
52
|
web (prop, { el }) {
|
|
@@ -14,6 +14,12 @@ module.exports = function ({ print }) {
|
|
|
14
14
|
const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
15
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
16
16
|
const baiduPropLog = print({ platform: 'baidu', tag: TAG_NAME, isError: false })
|
|
17
|
+
const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
|
|
18
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
19
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
|
+
const androidValueLogError = print({ platform: 'android', tag: TAG_NAME, isError: true, type: 'value' })
|
|
21
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
22
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
17
23
|
|
|
18
24
|
return {
|
|
19
25
|
test: TAG_NAME,
|
|
@@ -22,6 +28,14 @@ module.exports = function ({ print }) {
|
|
|
22
28
|
el.isBuiltIn = true
|
|
23
29
|
return 'mpx-textarea'
|
|
24
30
|
},
|
|
31
|
+
ios (tag, { el }) {
|
|
32
|
+
el.isBuiltIn = true
|
|
33
|
+
return 'mpx-textarea'
|
|
34
|
+
},
|
|
35
|
+
android (tag, { el }) {
|
|
36
|
+
el.isBuiltIn = true
|
|
37
|
+
return 'mpx-textarea'
|
|
38
|
+
},
|
|
25
39
|
props: [
|
|
26
40
|
{
|
|
27
41
|
test: /^(auto-focus|fixed|cursor-spacing|cursor|show-confirm-bar|selection-start|selection-end|adjust-position|hold-keyboard|disable-default-padding|confirm-type)$/,
|
|
@@ -47,6 +61,26 @@ module.exports = function ({ print }) {
|
|
|
47
61
|
{
|
|
48
62
|
test: /^(fixed|cursor-spacing|show-confirm-bar|adjust-position|hold-keyboard|auto-height)$/,
|
|
49
63
|
qa: qaPropLog
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
test: 'confirm-type',
|
|
67
|
+
ios ({ name, value }) {
|
|
68
|
+
const notSupported = ['return']
|
|
69
|
+
if (notSupported.includes(value)) {
|
|
70
|
+
iosValueLogError({ name, value })
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
android ({ name, value }) {
|
|
74
|
+
const notSupported = ['return']
|
|
75
|
+
if (notSupported.includes(value)) {
|
|
76
|
+
androidValueLogError({ name, value })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
test: /^(placeholder-style|placeholder-class|cursor-spacing|always-embed|adjust-position|hold-keyboard|disable-default-padding|adjust-keyboard-to|fixed|show-confirm-bar)$/,
|
|
82
|
+
ios: iosPropLog,
|
|
83
|
+
android: androidPropLog
|
|
50
84
|
}
|
|
51
85
|
],
|
|
52
86
|
event: [
|
|
@@ -71,6 +105,11 @@ module.exports = function ({ print }) {
|
|
|
71
105
|
{
|
|
72
106
|
test: /^(linechange|keyboardheightchange)$/,
|
|
73
107
|
tt: ttEventLog
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
test: /^keyboard.+$/,
|
|
111
|
+
ios: iosEventLog,
|
|
112
|
+
android: androidEventLog
|
|
74
113
|
}
|
|
75
114
|
]
|
|
76
115
|
}
|
|
@@ -10,6 +10,10 @@ const TT_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'cover-image', 'cover-view'
|
|
|
10
10
|
const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher', 'live-player', 'rich-text', 'audio', 'video', 'camera']
|
|
11
11
|
// 快应用不支持的标签集合
|
|
12
12
|
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']
|
|
13
|
+
// RN不支持的标签集合
|
|
14
|
+
const RN_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image',
|
|
15
|
+
'checkbox', 'checkbox-group', 'radio', 'radio-group', 'switch', 'movable-area', 'movable-view', 'icon', 'progress', 'rich-text', 'form', 'label', 'picker', 'picker-view', 'picker-view-column', 'slider',
|
|
16
|
+
'audio', 'camera', 'video', 'canvas', 'cover-image', 'cover-view', 'match-media', 'page-container', 'root-portal', 'editor', 'keyboard-accessory', 'navigator', 'map']
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* @param {function(object): function} print
|
|
@@ -22,6 +26,8 @@ module.exports = function ({ print }) {
|
|
|
22
26
|
const ttUnsupportedTagError = print({ platform: 'bytedance', isError: true, type: 'tag' })
|
|
23
27
|
const jdUnsupportedTagError = print({ platform: 'jd', isError: true, type: 'tag' })
|
|
24
28
|
const qaUnsupportedTagError = print({ platform: 'qa', isError: true, type: 'tag' })
|
|
29
|
+
const iosUnsupportedTagError = print({ platform: 'ios', isError: true, type: 'tag' })
|
|
30
|
+
const androidUnsupportedTagError = print({ platform: 'android', isError: true, type: 'tag' })
|
|
25
31
|
|
|
26
32
|
const aliUnsupportedExp = new RegExp('^(' + ALI_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
27
33
|
const baiduUnsupportedExp = new RegExp('^(' + BAIDU_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
@@ -29,6 +35,8 @@ module.exports = function ({ print }) {
|
|
|
29
35
|
const ttUnsupportedExp = new RegExp('^(' + TT_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
30
36
|
const jdUnsupportedExp = new RegExp('^(' + JD_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
31
37
|
const qaUnsupportedExp = new RegExp('^(' + QA_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
38
|
+
const iosUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
39
|
+
const androidUnsupportedExp = new RegExp('^(' + RN_UNSUPPORTED_TAG_NAME_ARR.join('|') + ')$')
|
|
32
40
|
|
|
33
41
|
return [
|
|
34
42
|
{
|
|
@@ -60,6 +68,16 @@ module.exports = function ({ print }) {
|
|
|
60
68
|
supportedModes: ['qa'],
|
|
61
69
|
test: qaUnsupportedExp,
|
|
62
70
|
qa: qaUnsupportedTagError
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
supportedModes: ['ios'],
|
|
74
|
+
test: iosUnsupportedExp,
|
|
75
|
+
ios: iosUnsupportedTagError
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
supportedModes: ['android'],
|
|
79
|
+
test: androidUnsupportedExp,
|
|
80
|
+
android: androidUnsupportedTagError
|
|
63
81
|
}
|
|
64
82
|
]
|
|
65
83
|
}
|
|
@@ -3,6 +3,8 @@ const TAG_NAME = 'view'
|
|
|
3
3
|
module.exports = function ({ print }) {
|
|
4
4
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
5
5
|
const qaEventLogError = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
|
|
6
|
+
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
7
|
+
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
6
8
|
|
|
7
9
|
return {
|
|
8
10
|
// 匹配标签名,可传递正则
|
|
@@ -21,6 +23,14 @@ module.exports = function ({ print }) {
|
|
|
21
23
|
return 'div'
|
|
22
24
|
}
|
|
23
25
|
},
|
|
26
|
+
ios (tag, { el }) {
|
|
27
|
+
el.isBuiltIn = true
|
|
28
|
+
return 'mpx-view'
|
|
29
|
+
},
|
|
30
|
+
android (tag, { el }) {
|
|
31
|
+
el.isBuiltIn = true
|
|
32
|
+
return 'mpx-view'
|
|
33
|
+
},
|
|
24
34
|
qa (tag) {
|
|
25
35
|
return 'div'
|
|
26
36
|
},
|
|
@@ -33,6 +43,10 @@ module.exports = function ({ print }) {
|
|
|
33
43
|
el.isBuiltIn = true
|
|
34
44
|
},
|
|
35
45
|
qa: qaPropLog
|
|
46
|
+
}, {
|
|
47
|
+
test: /^(hover-stop-propagation)$/,
|
|
48
|
+
android: androidPropLog,
|
|
49
|
+
ios: iosPropLog
|
|
36
50
|
}
|
|
37
51
|
],
|
|
38
52
|
// 组件事件中的差异部分
|
|
@@ -8,7 +8,7 @@ const normalize = require('../../../utils/normalize')
|
|
|
8
8
|
|
|
9
9
|
module.exports = function getSpec ({ warn, error }) {
|
|
10
10
|
const spec = {
|
|
11
|
-
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd'],
|
|
11
|
+
supportedModes: ['ali', 'swan', 'qq', 'tt', 'web', 'qa', 'jd', 'dd', 'ios', 'android'],
|
|
12
12
|
// props预处理
|
|
13
13
|
preProps: [],
|
|
14
14
|
// props后处理
|
|
@@ -398,6 +398,36 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
398
398
|
name: rPrefix + rEventName + meta.modifierStr,
|
|
399
399
|
value
|
|
400
400
|
}
|
|
401
|
+
},
|
|
402
|
+
ios ({ name, value }, { eventRules, el }) {
|
|
403
|
+
const match = this.test.exec(name)
|
|
404
|
+
const prefix = match[1]
|
|
405
|
+
const eventName = match[2]
|
|
406
|
+
const modifierStr = match[3] || ''
|
|
407
|
+
const meta = {
|
|
408
|
+
modifierStr
|
|
409
|
+
}
|
|
410
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'ios' })
|
|
411
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'ios', data: { el } })
|
|
412
|
+
return {
|
|
413
|
+
name: rPrefix + rEventName + meta.modifierStr,
|
|
414
|
+
value
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
android ({ name, value }, { eventRules, el }) {
|
|
418
|
+
const match = this.test.exec(name)
|
|
419
|
+
const prefix = match[1]
|
|
420
|
+
const eventName = match[2]
|
|
421
|
+
const modifierStr = match[3] || ''
|
|
422
|
+
const meta = {
|
|
423
|
+
modifierStr
|
|
424
|
+
}
|
|
425
|
+
const rPrefix = runRules(spec.event.prefix, prefix, { mode: 'android' })
|
|
426
|
+
const rEventName = runRules(eventRules, eventName, { mode: 'android', data: { el } })
|
|
427
|
+
return {
|
|
428
|
+
name: rPrefix + rEventName + meta.modifierStr,
|
|
429
|
+
value
|
|
430
|
+
}
|
|
401
431
|
}
|
|
402
432
|
},
|
|
403
433
|
// 无障碍
|
|
@@ -449,6 +479,28 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
449
479
|
meta.modifierStr = tempModifierStr ? '.' + tempModifierStr : ''
|
|
450
480
|
return '@'
|
|
451
481
|
}
|
|
482
|
+
// ios (prefix) {
|
|
483
|
+
// const prefixMap = {
|
|
484
|
+
// bind: 'on',
|
|
485
|
+
// catch: 'catch'
|
|
486
|
+
// }
|
|
487
|
+
// if (!prefixMap[prefix]) {
|
|
488
|
+
// error(`React native environment does not support [${prefix}] event handling!`)
|
|
489
|
+
// return
|
|
490
|
+
// }
|
|
491
|
+
// return prefixMap[prefix]
|
|
492
|
+
// },
|
|
493
|
+
// android (prefix) {
|
|
494
|
+
// const prefixMap = {
|
|
495
|
+
// bind: 'on',
|
|
496
|
+
// catch: 'catch'
|
|
497
|
+
// }
|
|
498
|
+
// if (!prefixMap[prefix]) {
|
|
499
|
+
// error(`React native environment does not support [${prefix}] event handling!`)
|
|
500
|
+
// return
|
|
501
|
+
// }
|
|
502
|
+
// return prefixMap[prefix]
|
|
503
|
+
// }
|
|
452
504
|
}
|
|
453
505
|
],
|
|
454
506
|
rules: [
|
|
@@ -479,14 +531,46 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
479
531
|
if (eventName === 'touchforcechange') {
|
|
480
532
|
error(`Web environment does not support [${eventName}] event!`)
|
|
481
533
|
}
|
|
534
|
+
},
|
|
535
|
+
ios (eventName) {
|
|
536
|
+
const eventMap = {
|
|
537
|
+
tap: 'tap',
|
|
538
|
+
longtap: 'longpress',
|
|
539
|
+
longpress: 'longpress',
|
|
540
|
+
touchstart: 'touchstart',
|
|
541
|
+
touchmove: 'touchmove',
|
|
542
|
+
touchend: 'touchend',
|
|
543
|
+
touchcancel: 'touchcancel'
|
|
544
|
+
}
|
|
545
|
+
if (eventMap[eventName]) {
|
|
546
|
+
return eventMap[eventName]
|
|
547
|
+
} else {
|
|
548
|
+
error(`React native environment does not support [${eventName}] event!`)
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
android (eventName) {
|
|
552
|
+
const eventMap = {
|
|
553
|
+
tap: 'tap',
|
|
554
|
+
longtap: 'longpress',
|
|
555
|
+
longpress: 'longpress',
|
|
556
|
+
touchstart: 'touchstart',
|
|
557
|
+
touchmove: 'touchmove',
|
|
558
|
+
touchend: 'touchend',
|
|
559
|
+
touchcancel: 'touchcancel'
|
|
560
|
+
}
|
|
561
|
+
if (eventMap[eventName]) {
|
|
562
|
+
return eventMap[eventName]
|
|
563
|
+
} else {
|
|
564
|
+
error(`React native environment does not support [${eventName}] event!`)
|
|
565
|
+
}
|
|
482
566
|
}
|
|
483
567
|
},
|
|
484
|
-
//
|
|
568
|
+
// web event escape
|
|
485
569
|
{
|
|
486
570
|
test: /^click$/,
|
|
487
|
-
web (eventName,
|
|
571
|
+
web (eventName, { isComponent }) {
|
|
488
572
|
// 自定义组件根节点
|
|
489
|
-
if (
|
|
573
|
+
if (isComponent) {
|
|
490
574
|
return '_' + eventName
|
|
491
575
|
}
|
|
492
576
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const async = require('async')
|
|
2
|
+
const processJSON = require('./processJSON')
|
|
3
|
+
const processMainScript = require('./processMainScript')
|
|
4
|
+
const processTemplate = require('./processTemplate')
|
|
5
|
+
const processStyles = require('./processStyles')
|
|
6
|
+
const processScript = require('./processScript')
|
|
7
|
+
const RecordLoaderContentDependency = require('../dependencies/RecordLoaderContentDependency')
|
|
8
|
+
|
|
9
|
+
module.exports = function ({
|
|
10
|
+
parts,
|
|
11
|
+
loaderContext,
|
|
12
|
+
pagesMap,
|
|
13
|
+
componentsMap,
|
|
14
|
+
queryObj,
|
|
15
|
+
ctorType,
|
|
16
|
+
srcMode,
|
|
17
|
+
moduleId,
|
|
18
|
+
isProduction,
|
|
19
|
+
hasScoped,
|
|
20
|
+
hasComment,
|
|
21
|
+
isNative,
|
|
22
|
+
usingComponents,
|
|
23
|
+
componentGenerics,
|
|
24
|
+
autoScope,
|
|
25
|
+
callback
|
|
26
|
+
}) {
|
|
27
|
+
if (ctorType === 'app' && !queryObj.isApp) {
|
|
28
|
+
return processMainScript(parts.script, {
|
|
29
|
+
loaderContext
|
|
30
|
+
}, (err, scriptRes) => {
|
|
31
|
+
if (err) return callback(err)
|
|
32
|
+
loaderContext.loaderIndex = -1
|
|
33
|
+
return callback(null, scriptRes.output)
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
const mpx = loaderContext.getMpx()
|
|
37
|
+
// 通过RecordLoaderContentDependency和loaderContentCache确保子request不再重复生成loaderContent
|
|
38
|
+
const cacheContent = mpx.loaderContentCache.get(loaderContext.resourcePath)
|
|
39
|
+
if (cacheContent) return callback(null, cacheContent)
|
|
40
|
+
let output = ''
|
|
41
|
+
return async.waterfall([
|
|
42
|
+
(callback) => {
|
|
43
|
+
async.parallel([
|
|
44
|
+
(callback) => {
|
|
45
|
+
processTemplate(parts.template, {
|
|
46
|
+
loaderContext,
|
|
47
|
+
hasScoped,
|
|
48
|
+
hasComment,
|
|
49
|
+
isNative,
|
|
50
|
+
srcMode,
|
|
51
|
+
moduleId,
|
|
52
|
+
ctorType,
|
|
53
|
+
usingComponents,
|
|
54
|
+
componentGenerics
|
|
55
|
+
}, callback)
|
|
56
|
+
},
|
|
57
|
+
(callback) => {
|
|
58
|
+
processStyles(parts.styles, {
|
|
59
|
+
loaderContext,
|
|
60
|
+
srcMode,
|
|
61
|
+
ctorType,
|
|
62
|
+
autoScope,
|
|
63
|
+
moduleId
|
|
64
|
+
}, callback)
|
|
65
|
+
},
|
|
66
|
+
(callback) => {
|
|
67
|
+
processJSON(parts.json, {
|
|
68
|
+
loaderContext,
|
|
69
|
+
ctorType,
|
|
70
|
+
pagesMap,
|
|
71
|
+
componentsMap
|
|
72
|
+
}, callback)
|
|
73
|
+
}
|
|
74
|
+
], (err, res) => {
|
|
75
|
+
callback(err, res)
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
([templateRes, stylesRes, jsonRes], callback) => {
|
|
79
|
+
output += templateRes.output
|
|
80
|
+
output += stylesRes.output
|
|
81
|
+
output += jsonRes.output
|
|
82
|
+
processScript(parts.script, {
|
|
83
|
+
loaderContext,
|
|
84
|
+
ctorType,
|
|
85
|
+
srcMode,
|
|
86
|
+
moduleId,
|
|
87
|
+
isProduction,
|
|
88
|
+
componentGenerics,
|
|
89
|
+
jsonConfig: jsonRes.jsonObj,
|
|
90
|
+
outputPath: queryObj.outputPath || '',
|
|
91
|
+
builtInComponentsMap: templateRes.builtInComponentsMap,
|
|
92
|
+
genericsInfo: templateRes.genericsInfo,
|
|
93
|
+
wxsModuleMap: templateRes.wxsModuleMap,
|
|
94
|
+
localComponentsMap: jsonRes.localComponentsMap,
|
|
95
|
+
localPagesMap: jsonRes.localPagesMap
|
|
96
|
+
}, callback)
|
|
97
|
+
}
|
|
98
|
+
], (err, scriptRes) => {
|
|
99
|
+
if (err) return callback(err)
|
|
100
|
+
output += scriptRes.output
|
|
101
|
+
loaderContext._module.addPresentationalDependency(new RecordLoaderContentDependency(loaderContext.resourcePath, output))
|
|
102
|
+
callback(null, output)
|
|
103
|
+
})
|
|
104
|
+
}
|