@mpxjs/webpack-plugin 2.10.22 → 2.10.24-beta.1
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/index.js +4 -1
- package/lib/loader.js +2 -0
- package/lib/react/index.js +3 -1
- package/lib/react/processTemplate.js +3 -1
- package/lib/resolver/AddEnvPlugin.js +1 -1
- package/lib/resolver/AddModePlugin.js +1 -1
- package/lib/resolver/ExtendComponentsPlugin.js +91 -0
- package/lib/runtime/components/extends/section-list.mpx +14 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +3 -1
- package/lib/runtime/components/react/dist/mpx-section-list.d.ts +56 -0
- package/lib/runtime/components/react/dist/mpx-section-list.jsx +484 -0
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +12 -12
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +12 -12
- package/lib/runtime/components/react/dist/mpx-text.jsx +15 -15
- package/lib/runtime/components/react/dist/mpx-view.jsx +15 -15
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +2 -1
- package/lib/runtime/components/react/dist/utils.d.ts +1 -0
- package/lib/runtime/components/react/dist/utils.jsx +4 -1
- package/lib/runtime/components/react/mpx-canvas/index.tsx +4 -2
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +3 -1
- package/lib/runtime/components/react/mpx-section-list.tsx +734 -0
- package/lib/runtime/components/react/mpx-simple-text.tsx +12 -12
- package/lib/runtime/components/react/mpx-simple-view.tsx +12 -12
- package/lib/runtime/components/react/mpx-text.tsx +15 -15
- package/lib/runtime/components/react/mpx-view.tsx +15 -15
- package/lib/runtime/components/react/mpx-web-view.tsx +4 -3
- package/lib/runtime/components/react/utils.tsx +5 -1
- package/lib/template-compiler/compiler.js +5 -1
- package/lib/utils/source-location.js +9 -13
- package/lib/web/index.js +3 -1
- package/lib/web/processTemplate.js +3 -1
- package/package.json +4 -3
- package/LICENSE +0 -433
|
@@ -6,12 +6,12 @@ import { TextPassThroughContext } from './context'
|
|
|
6
6
|
import * as perf from '@mpxjs/perf'
|
|
7
7
|
|
|
8
8
|
const SimpleText = (props: TextProps): JSX.Element => {
|
|
9
|
-
let
|
|
10
|
-
if (__mpx_perf_framework__)
|
|
9
|
+
let idTotal = -1
|
|
10
|
+
if (__mpx_perf_framework__) idTotal = perf.scopeStart('simple-text:render:total')
|
|
11
11
|
|
|
12
12
|
// ───── style 阶段 ─────
|
|
13
|
-
let
|
|
14
|
-
if (__mpx_perf_framework__)
|
|
13
|
+
let idStyle = -1
|
|
14
|
+
if (__mpx_perf_framework__) idStyle = perf.scopeStart('simple-text:render:style')
|
|
15
15
|
const inheritedText = useContext(TextPassThroughContext)
|
|
16
16
|
const mergedStyle = extendObject({}, inheritedText?.textStyle, props.style)
|
|
17
17
|
let hasBoxSizingAffectingStyle = false
|
|
@@ -36,11 +36,11 @@ const SimpleText = (props: TextProps): JSX.Element => {
|
|
|
36
36
|
disabled: isStringOnly
|
|
37
37
|
}
|
|
38
38
|
)
|
|
39
|
-
if (__mpx_perf_framework__)
|
|
39
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idStyle)
|
|
40
40
|
|
|
41
41
|
// ───── innerProps 阶段 ─────
|
|
42
|
-
let
|
|
43
|
-
if (__mpx_perf_framework__)
|
|
42
|
+
let idInnerProps = -1
|
|
43
|
+
if (__mpx_perf_framework__) idInnerProps = perf.scopeStart('simple-text:render:innerProps')
|
|
44
44
|
const innerProps = useInnerProps(
|
|
45
45
|
extendObject(
|
|
46
46
|
{},
|
|
@@ -51,11 +51,11 @@ const SimpleText = (props: TextProps): JSX.Element => {
|
|
|
51
51
|
}
|
|
52
52
|
)
|
|
53
53
|
)
|
|
54
|
-
if (__mpx_perf_framework__)
|
|
54
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idInnerProps)
|
|
55
55
|
|
|
56
56
|
// ───── createElement 阶段 ─────
|
|
57
|
-
let
|
|
58
|
-
if (__mpx_perf_framework__)
|
|
57
|
+
let idCreate = -1
|
|
58
|
+
if (__mpx_perf_framework__) idCreate = perf.scopeStart('simple-text:render:createElement')
|
|
59
59
|
const result = createElement(Text, innerProps, wrapChildren(
|
|
60
60
|
{ children },
|
|
61
61
|
{
|
|
@@ -63,9 +63,9 @@ const SimpleText = (props: TextProps): JSX.Element => {
|
|
|
63
63
|
textPassThrough: childTextPassThrough
|
|
64
64
|
}
|
|
65
65
|
))
|
|
66
|
-
if (__mpx_perf_framework__)
|
|
66
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idCreate)
|
|
67
67
|
|
|
68
|
-
if (__mpx_perf_framework__)
|
|
68
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idTotal)
|
|
69
69
|
return result
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -5,12 +5,12 @@ import useInnerProps from './getInnerListeners'
|
|
|
5
5
|
import * as perf from '@mpxjs/perf'
|
|
6
6
|
|
|
7
7
|
const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
|
|
8
|
-
let
|
|
9
|
-
if (__mpx_perf_framework__)
|
|
8
|
+
let idTotal = -1
|
|
9
|
+
if (__mpx_perf_framework__) idTotal = perf.scopeStart('simple-view:render:total')
|
|
10
10
|
|
|
11
11
|
// ───── style 阶段 ─────
|
|
12
|
-
let
|
|
13
|
-
if (__mpx_perf_framework__)
|
|
12
|
+
let idStyle = -1
|
|
13
|
+
if (__mpx_perf_framework__) idStyle = perf.scopeStart('simple-view:render:style')
|
|
14
14
|
const { textProps, innerProps: props = {} } = splitProps(simpleViewProps)
|
|
15
15
|
|
|
16
16
|
let hasBoxSizingAffectingStyle = false
|
|
@@ -20,11 +20,11 @@ const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
|
|
|
20
20
|
}
|
|
21
21
|
})
|
|
22
22
|
const textPassThrough = useTextPassThroughValue(textStyle as TextStyle, textProps)
|
|
23
|
-
if (__mpx_perf_framework__)
|
|
23
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idStyle)
|
|
24
24
|
|
|
25
25
|
// ───── innerProps 阶段 ─────
|
|
26
|
-
let
|
|
27
|
-
if (__mpx_perf_framework__)
|
|
26
|
+
let idInnerProps = -1
|
|
27
|
+
if (__mpx_perf_framework__) idInnerProps = perf.scopeStart('simple-view:render:innerProps')
|
|
28
28
|
const innerProps = useInnerProps(
|
|
29
29
|
extendObject(
|
|
30
30
|
{},
|
|
@@ -34,11 +34,11 @@ const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
|
|
|
34
34
|
}
|
|
35
35
|
)
|
|
36
36
|
)
|
|
37
|
-
if (__mpx_perf_framework__)
|
|
37
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idInnerProps)
|
|
38
38
|
|
|
39
39
|
// ───── createElement 阶段 ─────
|
|
40
|
-
let
|
|
41
|
-
if (__mpx_perf_framework__)
|
|
40
|
+
let idCreate = -1
|
|
41
|
+
if (__mpx_perf_framework__) idCreate = perf.scopeStart('simple-view:render:createElement')
|
|
42
42
|
const result = createElement(View, innerProps, wrapChildren(
|
|
43
43
|
props,
|
|
44
44
|
{
|
|
@@ -46,9 +46,9 @@ const SimpleView = (simpleViewProps: ViewProps): JSX.Element => {
|
|
|
46
46
|
textPassThrough
|
|
47
47
|
}
|
|
48
48
|
))
|
|
49
|
-
if (__mpx_perf_framework__)
|
|
49
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idCreate)
|
|
50
50
|
|
|
51
|
-
if (__mpx_perf_framework__)
|
|
51
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idTotal)
|
|
52
52
|
return result
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -53,12 +53,12 @@ interface _TextProps extends TextProps {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref): JSX.Element => {
|
|
56
|
-
let
|
|
57
|
-
if (__mpx_perf_framework__)
|
|
56
|
+
let idTotal = -1
|
|
57
|
+
if (__mpx_perf_framework__) idTotal = perf.scopeStart('text:render:total')
|
|
58
58
|
|
|
59
59
|
// ───── props 阶段 ─────
|
|
60
|
-
let
|
|
61
|
-
if (__mpx_perf_framework__)
|
|
60
|
+
let idProps = -1
|
|
61
|
+
if (__mpx_perf_framework__) idProps = perf.scopeStart('text:render:props')
|
|
62
62
|
const inheritedText = useContext(TextPassThroughContext)
|
|
63
63
|
const mergedProps = extendObject({}, inheritedText?.pendingTextProps, props)
|
|
64
64
|
const {
|
|
@@ -73,11 +73,11 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
73
73
|
'parent-height': parentHeight,
|
|
74
74
|
decode
|
|
75
75
|
} = mergedProps
|
|
76
|
-
if (__mpx_perf_framework__)
|
|
76
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idProps)
|
|
77
77
|
|
|
78
78
|
// ───── style 阶段 ─────
|
|
79
|
-
let
|
|
80
|
-
if (__mpx_perf_framework__)
|
|
79
|
+
let idStyle = -1
|
|
80
|
+
if (__mpx_perf_framework__) idStyle = perf.scopeStart('text:render:style')
|
|
81
81
|
const {
|
|
82
82
|
normalStyle,
|
|
83
83
|
hasVarDec,
|
|
@@ -112,11 +112,11 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
112
112
|
disabled: isStringOnly
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
|
-
if (__mpx_perf_framework__)
|
|
115
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idStyle)
|
|
116
116
|
|
|
117
117
|
// ───── innerProps 阶段 ─────
|
|
118
|
-
let
|
|
119
|
-
if (__mpx_perf_framework__)
|
|
118
|
+
let idInnerProps = -1
|
|
119
|
+
if (__mpx_perf_framework__) idInnerProps = perf.scopeStart('text:render:innerProps')
|
|
120
120
|
const innerProps = useInnerProps(
|
|
121
121
|
extendObject(
|
|
122
122
|
{},
|
|
@@ -133,11 +133,11 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
133
133
|
'decode'
|
|
134
134
|
]
|
|
135
135
|
)
|
|
136
|
-
if (__mpx_perf_framework__)
|
|
136
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idInnerProps)
|
|
137
137
|
|
|
138
138
|
// ───── createElement 阶段 ─────
|
|
139
|
-
let
|
|
140
|
-
if (__mpx_perf_framework__)
|
|
139
|
+
let idCreate = -1
|
|
140
|
+
if (__mpx_perf_framework__) idCreate = perf.scopeStart('text:render:createElement')
|
|
141
141
|
let finalComponent:JSX.Element = createElement(Text, innerProps, wrapChildren(
|
|
142
142
|
extendObject({}, mergedProps, {
|
|
143
143
|
children
|
|
@@ -152,9 +152,9 @@ const _Text = forwardRef<HandlerRef<Text, _TextProps>, _TextProps>((props, ref):
|
|
|
152
152
|
if (hasPositionFixed) {
|
|
153
153
|
finalComponent = createElement(Portal, null, finalComponent)
|
|
154
154
|
}
|
|
155
|
-
if (__mpx_perf_framework__)
|
|
155
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idCreate)
|
|
156
156
|
|
|
157
|
-
if (__mpx_perf_framework__)
|
|
157
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idTotal)
|
|
158
158
|
return finalComponent
|
|
159
159
|
})
|
|
160
160
|
|
|
@@ -703,12 +703,12 @@ function wrapWithChildren (props: _ViewProps, { hasVarDec, enableBackground, bac
|
|
|
703
703
|
|
|
704
704
|
const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, ref): JSX.Element => {
|
|
705
705
|
// 性能探针 - total
|
|
706
|
-
let
|
|
707
|
-
if (__mpx_perf_framework__)
|
|
706
|
+
let idTotal = -1
|
|
707
|
+
if (__mpx_perf_framework__) idTotal = perf.scopeStart('view:render:total')
|
|
708
708
|
|
|
709
709
|
// ───── props 阶段 ─────
|
|
710
|
-
let
|
|
711
|
-
if (__mpx_perf_framework__)
|
|
710
|
+
let idProps = -1
|
|
711
|
+
if (__mpx_perf_framework__) idProps = perf.scopeStart('view:render:props')
|
|
712
712
|
const { textProps, innerProps: props = {} } = splitProps(viewProps)
|
|
713
713
|
let {
|
|
714
714
|
style = {},
|
|
@@ -742,11 +742,11 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
|
|
|
742
742
|
const { isHover, gesture } = useHover({ enableHover, hoverStartTime, hoverStayTime })
|
|
743
743
|
|
|
744
744
|
const styleObj: ExtendedViewStyle = extendObject({}, defaultStyle, style, isHover ? hoverStyle as ExtendedViewStyle : {})
|
|
745
|
-
if (__mpx_perf_framework__)
|
|
745
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idProps)
|
|
746
746
|
|
|
747
747
|
// ───── style 阶段 ─────
|
|
748
|
-
let
|
|
749
|
-
if (__mpx_perf_framework__)
|
|
748
|
+
let idStyle = -1
|
|
749
|
+
if (__mpx_perf_framework__) idStyle = perf.scopeStart('view:render:style')
|
|
750
750
|
const {
|
|
751
751
|
normalStyle,
|
|
752
752
|
hasSelfPercent,
|
|
@@ -796,11 +796,11 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
|
|
|
796
796
|
style: viewStyle,
|
|
797
797
|
transitionend
|
|
798
798
|
})
|
|
799
|
-
if (__mpx_perf_framework__)
|
|
799
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idStyle)
|
|
800
800
|
|
|
801
801
|
// ───── innerProps 阶段 ─────
|
|
802
|
-
let
|
|
803
|
-
if (__mpx_perf_framework__)
|
|
802
|
+
let idInnerProps = -1
|
|
803
|
+
if (__mpx_perf_framework__) idInnerProps = perf.scopeStart('view:render:innerProps')
|
|
804
804
|
const innerProps = useInnerProps(
|
|
805
805
|
extendObject(
|
|
806
806
|
{},
|
|
@@ -826,11 +826,11 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
|
|
|
826
826
|
layoutRef
|
|
827
827
|
}
|
|
828
828
|
)
|
|
829
|
-
if (__mpx_perf_framework__)
|
|
829
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idInnerProps)
|
|
830
830
|
|
|
831
831
|
// ───── createElement 阶段 ─────
|
|
832
|
-
let
|
|
833
|
-
if (__mpx_perf_framework__)
|
|
832
|
+
let idCreate = -1
|
|
833
|
+
if (__mpx_perf_framework__) idCreate = perf.scopeStart('view:render:createElement')
|
|
834
834
|
const childNode = wrapWithChildren(props, {
|
|
835
835
|
hasVarDec,
|
|
836
836
|
enableBackground: enableBackgroundRef.current,
|
|
@@ -852,9 +852,9 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
|
|
|
852
852
|
if (hasPositionFixed) {
|
|
853
853
|
finalComponent = createElement(Portal, null, finalComponent)
|
|
854
854
|
}
|
|
855
|
-
if (__mpx_perf_framework__)
|
|
855
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idCreate)
|
|
856
856
|
|
|
857
|
-
if (__mpx_perf_framework__)
|
|
857
|
+
if (__mpx_perf_framework__) perf.scopeEnd(idTotal)
|
|
858
858
|
return finalComponent
|
|
859
859
|
})
|
|
860
860
|
|
|
@@ -30,6 +30,7 @@ interface WebViewProps {
|
|
|
30
30
|
binderror?: (event: CommonCallbackEvent) => void
|
|
31
31
|
[x: string]: any
|
|
32
32
|
}
|
|
33
|
+
type WebViewInstance = WebView<{}>
|
|
33
34
|
type Listener = (type: string, callback: (e: Event) => void) => () => void
|
|
34
35
|
|
|
35
36
|
interface PayloadData {
|
|
@@ -77,7 +78,7 @@ const styles = StyleSheet.create({
|
|
|
77
78
|
}
|
|
78
79
|
})
|
|
79
80
|
|
|
80
|
-
const _WebView = forwardRef<HandlerRef<
|
|
81
|
+
const _WebView = forwardRef<HandlerRef<WebViewInstance, WebViewProps>, WebViewProps>((props, ref): JSX.Element | null => {
|
|
81
82
|
const { src, bindmessage, bindload, binderror } = props
|
|
82
83
|
const mpx = global.__mpx
|
|
83
84
|
const errorText: ErrorTextMap = {
|
|
@@ -98,7 +99,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
98
99
|
const { pageId } = useContext(RouteContext) || {}
|
|
99
100
|
const [pageLoadErr, setPageLoadErr] = useState<boolean>(false)
|
|
100
101
|
const currentPage = useMemo(() => getCurrentPage(pageId), [pageId])
|
|
101
|
-
const webViewRef = useRef<
|
|
102
|
+
const webViewRef = useRef<WebViewInstance>(null)
|
|
102
103
|
const fristLoaded = useRef<boolean>(false)
|
|
103
104
|
const isLoadError = useRef<boolean>(false)
|
|
104
105
|
const isNavigateBack = useRef<boolean>(false)
|
|
@@ -123,7 +124,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
|
|
|
123
124
|
isNavigateBack.current = false
|
|
124
125
|
})
|
|
125
126
|
|
|
126
|
-
useNodesRef<
|
|
127
|
+
useNodesRef<WebViewInstance, WebViewProps>(props, ref, webViewRef, {
|
|
127
128
|
style: defaultWebViewStyle
|
|
128
129
|
})
|
|
129
130
|
|
|
@@ -816,6 +816,7 @@ export function usePrevious<T> (value: T): T | undefined {
|
|
|
816
816
|
export interface GestureHandler {
|
|
817
817
|
nodeRefs?: Array<{ getNodeInstance: () => { nodeRef: unknown } }>
|
|
818
818
|
current?: unknown
|
|
819
|
+
handlerTag?: number
|
|
819
820
|
}
|
|
820
821
|
|
|
821
822
|
export function flatGesture (gestures: Array<GestureHandler> = []) {
|
|
@@ -824,7 +825,10 @@ export function flatGesture (gestures: Array<GestureHandler> = []) {
|
|
|
824
825
|
return gesture.nodeRefs
|
|
825
826
|
.map((item: { getNodeInstance: () => any }) => item.getNodeInstance()?.instance?.gestureRef || {})
|
|
826
827
|
}
|
|
827
|
-
|
|
828
|
+
if (gesture && (gesture.current || gesture.handlerTag !== undefined)) {
|
|
829
|
+
return [gesture]
|
|
830
|
+
}
|
|
831
|
+
return []
|
|
828
832
|
})) || []
|
|
829
833
|
}
|
|
830
834
|
|
|
@@ -849,9 +849,13 @@ function parse (template, options) {
|
|
|
849
849
|
})
|
|
850
850
|
|
|
851
851
|
if (!tagNames.has('component') && !tagNames.has('template') && options.checkUsingComponents) {
|
|
852
|
+
// usingComponents 与 tagNames 均为 rulesRunner 处理后的名字(capitalToHyphen / mpx-com- 前缀已对齐),
|
|
853
|
+
// 反向排除 globalComponents 以避免对仅在 app 注册的组件误报「未使用」
|
|
854
|
+
const globalComponents = options.globalComponents || []
|
|
855
|
+
const componentPlaceholder = options.componentPlaceholder || []
|
|
852
856
|
const arr = []
|
|
853
857
|
usingComponents.forEach((item) => {
|
|
854
|
-
if (!tagNames.has(item) && !
|
|
858
|
+
if (!tagNames.has(item) && !globalComponents.includes(item) && !componentPlaceholder.includes(item)) {
|
|
855
859
|
arr.push(item)
|
|
856
860
|
}
|
|
857
861
|
})
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const { codeFrameColumns } = require('@babel/code-frame')
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
TraceMap,
|
|
5
|
+
originalPositionFor: traceOriginalPositionFor,
|
|
6
|
+
sourceContentFor
|
|
7
|
+
} = require('@jridgewell/trace-mapping')
|
|
4
8
|
|
|
5
9
|
function offsetToPosition (source, offset) {
|
|
6
10
|
const before = source.slice(0, offset)
|
|
@@ -45,25 +49,17 @@ function createCodeFrame (source, loc) {
|
|
|
45
49
|
function originalPositionFor (map, loc) {
|
|
46
50
|
loc = normalizeLoc(loc)
|
|
47
51
|
if (!map || !loc || !loc.start) return
|
|
48
|
-
|
|
49
|
-
try {
|
|
50
|
-
map = JSON.parse(map)
|
|
51
|
-
} catch (e) {
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
let consumer
|
|
52
|
+
let tracer
|
|
56
53
|
try {
|
|
57
|
-
|
|
54
|
+
tracer = new TraceMap(map)
|
|
58
55
|
} catch (e) {
|
|
59
56
|
return
|
|
60
57
|
}
|
|
61
|
-
const original =
|
|
58
|
+
const original = traceOriginalPositionFor(tracer, {
|
|
62
59
|
line: loc.start.line,
|
|
63
60
|
column: Math.max((loc.start.column || 1) - 1, 0)
|
|
64
61
|
})
|
|
65
62
|
if (!original || !original.source || !original.line) return
|
|
66
|
-
const sourceIndex = map.sources && map.sources.indexOf(original.source)
|
|
67
63
|
return {
|
|
68
64
|
file: original.source,
|
|
69
65
|
loc: {
|
|
@@ -72,7 +68,7 @@ function originalPositionFor (map, loc) {
|
|
|
72
68
|
column: (original.column || 0) + 1
|
|
73
69
|
}
|
|
74
70
|
},
|
|
75
|
-
source:
|
|
71
|
+
source: sourceContentFor(tracer, original.source) || undefined,
|
|
76
72
|
generatedLoc: loc
|
|
77
73
|
}
|
|
78
74
|
}
|
package/lib/web/index.js
CHANGED
|
@@ -23,6 +23,7 @@ module.exports = function ({
|
|
|
23
23
|
usingComponentsInfo,
|
|
24
24
|
originalUsingComponents,
|
|
25
25
|
componentGenerics,
|
|
26
|
+
componentPlaceholder,
|
|
26
27
|
autoScope,
|
|
27
28
|
callback
|
|
28
29
|
}) {
|
|
@@ -72,7 +73,8 @@ module.exports = function ({
|
|
|
72
73
|
ctorType,
|
|
73
74
|
usingComponentsInfo,
|
|
74
75
|
originalUsingComponents,
|
|
75
|
-
componentGenerics
|
|
76
|
+
componentGenerics,
|
|
77
|
+
componentPlaceholder
|
|
76
78
|
}, callback)
|
|
77
79
|
},
|
|
78
80
|
(callback) => {
|
|
@@ -15,7 +15,8 @@ module.exports = function (template, {
|
|
|
15
15
|
ctorType,
|
|
16
16
|
usingComponentsInfo,
|
|
17
17
|
originalUsingComponents,
|
|
18
|
-
componentGenerics
|
|
18
|
+
componentGenerics,
|
|
19
|
+
componentPlaceholder
|
|
19
20
|
}, callback) {
|
|
20
21
|
const mpx = loaderContext.getMpx()
|
|
21
22
|
const {
|
|
@@ -99,6 +100,7 @@ module.exports = function (template, {
|
|
|
99
100
|
i18n: null,
|
|
100
101
|
// 与 template-compiler/index 一致:usingComponentsInfo 已合并 globalComponentsInfo,此处白名单避免对仅 app 注册的组件误报「未使用」
|
|
101
102
|
globalComponents: Object.keys(globalComponents || {}),
|
|
103
|
+
componentPlaceholder,
|
|
102
104
|
// web模式下实现抽象组件
|
|
103
105
|
componentGenerics,
|
|
104
106
|
hasVirtualHost,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.24-beta.1",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"@better-scroll/slide": "^2.5.1",
|
|
29
29
|
"@better-scroll/wheel": "^2.5.1",
|
|
30
30
|
"@better-scroll/zoom": "^2.5.1",
|
|
31
|
-
"@
|
|
31
|
+
"@jridgewell/trace-mapping": "^0.3.25",
|
|
32
|
+
"@mpxjs/perf": "^2.10.24",
|
|
32
33
|
"@mpxjs/template-engine": "^2.8.7",
|
|
33
34
|
"@mpxjs/utils": "^2.10.21",
|
|
34
35
|
"acorn": "^8.11.3",
|
|
@@ -114,5 +115,5 @@
|
|
|
114
115
|
"engines": {
|
|
115
116
|
"node": ">=14.14.0"
|
|
116
117
|
},
|
|
117
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "2d37697869b9bdda3efab92dda8c910b68fd05c0"
|
|
118
119
|
}
|