@mpxjs/webpack-plugin 2.10.17-beta.4 → 2.10.17-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/global.d.ts +240 -11
- package/lib/index.js +7 -0
- package/lib/loader.js +4 -0
- package/lib/platform/template/wx/component-config/button.js +1 -1
- package/lib/platform/template/wx/component-config/input.js +1 -1
- package/lib/platform/template/wx/component-config/textarea.js +1 -1
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +0 -1
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +0 -1
- package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +0 -1
- package/lib/runtime/components/react/dist/context.d.ts +0 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-input.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-input.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +4 -2
- package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-nav.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +1 -1
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +43 -23
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/mpx-view.jsx +20 -6
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -1
- package/lib/runtime/components/react/dist/parser.d.ts +0 -1
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -1
- package/lib/runtime/components/react/dist/utils.d.ts +0 -1
- package/lib/runtime/components/react/mpx-input.tsx +1 -1
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +4 -2
- package/lib/runtime/components/react/mpx-swiper.tsx +43 -22
- package/lib/runtime/components/react/mpx-view.tsx +23 -7
- package/lib/runtime/components/react/tsconfig.json +26 -0
- package/lib/style-compiler/strip-conditional-loader.js +45 -29
- package/package.json +5 -4
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/animationHooks/utils.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
package/lib/global.d.ts
CHANGED
|
@@ -1,16 +1,245 @@
|
|
|
1
|
+
import * as webpack from 'webpack'
|
|
2
|
+
|
|
3
|
+
declare module 'webpack' {
|
|
4
|
+
interface Compilation {
|
|
5
|
+
__mpx__: MpxContext
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface Compiler {
|
|
9
|
+
__mpx__?: boolean
|
|
10
|
+
}
|
|
11
|
+
}
|
|
1
12
|
|
|
2
13
|
declare global {
|
|
3
14
|
interface MpxWebpackPluginOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
+
style: {
|
|
16
|
+
cssCondition?: {
|
|
17
|
+
before?: boolean
|
|
18
|
+
after?: boolean
|
|
19
|
+
beforeExclude?: (string | RegExp)[]
|
|
20
|
+
afterExclude?: (string | RegExp)[]
|
|
21
|
+
legacy?: boolean
|
|
22
|
+
afterLegacy?: boolean
|
|
23
|
+
beforeLegacy?: boolean
|
|
24
|
+
}
|
|
15
25
|
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type MpxLoaderContext<T> = webpack.LoaderContext<T> & {
|
|
29
|
+
getMpx(): MpxContext
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface MpxContext {
|
|
33
|
+
/**
|
|
34
|
+
* 用于使用 webpack-virtual-modules 功能,目前仅在输出 web 时支持使用
|
|
35
|
+
*/
|
|
36
|
+
__vfs: any | null
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* app 信息,便于获取 appName
|
|
40
|
+
*/
|
|
41
|
+
appInfo: {
|
|
42
|
+
resourcePath?: string
|
|
43
|
+
name?: string
|
|
44
|
+
[key: string]: any
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* pageConfig 信息
|
|
49
|
+
*/
|
|
50
|
+
pageConfigsMap: Record<string, any>
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* pages 全局记录,无需区分主包/分包
|
|
54
|
+
*/
|
|
55
|
+
pagesMap: Record<string, string>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 组件资源记录,按所属包进行记录(如 componentsMap.main)
|
|
59
|
+
*/
|
|
60
|
+
componentsMap: Record<string, Record<string, string>>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 静态资源(图片、字体、独立样式)等,按所属包进行记录
|
|
64
|
+
*/
|
|
65
|
+
staticResourcesMap: Record<string, Record<string, string>>
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 用于记录命中 subpackageModulesRules 的 JS 模块分包归属,用于 JS 多分包冗余输出
|
|
69
|
+
*/
|
|
70
|
+
subpackageModulesMap: Record<string, Record<string, string>>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 记录其他资源,如 pluginMain、pluginExport,无需区分主包/分包
|
|
74
|
+
*/
|
|
75
|
+
otherResourcesMap: Record<string, any>
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 记录独立分包
|
|
79
|
+
*/
|
|
80
|
+
independentSubpackagesMap: Record<string, any>
|
|
81
|
+
|
|
82
|
+
subpackagesEntriesMap: Record<string, any>
|
|
83
|
+
postSubpackageEntriesMap: Record<string, any>
|
|
84
|
+
replacePathMap: Record<string, string>
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 导出模块集合
|
|
88
|
+
*/
|
|
89
|
+
exportModules: Set<any>
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 记录动态添加入口的分包信息
|
|
93
|
+
*/
|
|
94
|
+
dynamicEntryInfo: Record<string, any>
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 记录 entryModule 与 entryNode 的对应关系,用于体积分析
|
|
98
|
+
*/
|
|
99
|
+
entryNodeModulesMap: Map<any, any>
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 记录与 asset 相关联的 modules,用于体积分析
|
|
103
|
+
*/
|
|
104
|
+
assetsModulesMap: Map<string, Set<any>>
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 记录与 asset 相关联的 AST,用于体积分析和 esCheck,避免重复 parse
|
|
108
|
+
*/
|
|
109
|
+
assetsASTsMap: Map<string, any>
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 记录 RequireExternalDependency 相关资源路径
|
|
113
|
+
*/
|
|
114
|
+
externalRequestsMap: Map<string, any>
|
|
115
|
+
|
|
116
|
+
globalComponents: Record<string, any>
|
|
117
|
+
globalComponentsInfo: Record<string, any>
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* todo: es6 Map 读写性能高于 object,之后会逐步替换
|
|
121
|
+
*/
|
|
122
|
+
wxsAssetsCache: Map<string, any>
|
|
123
|
+
addEntryPromiseMap: Map<string, Promise<any>>
|
|
124
|
+
currentPackageRoot: string
|
|
125
|
+
wxsContentMap: Record<string, string>
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 是否强制使用页面构造函数
|
|
129
|
+
*/
|
|
130
|
+
forceUsePageCtor: boolean
|
|
131
|
+
|
|
132
|
+
resolveMode: string
|
|
133
|
+
mode: string
|
|
134
|
+
srcMode: string
|
|
135
|
+
env: string
|
|
136
|
+
externalClasses: string[]
|
|
137
|
+
projectRoot: string
|
|
138
|
+
autoScopeRules: any
|
|
139
|
+
autoVirtualHostRules: any
|
|
140
|
+
customTextRules: any
|
|
141
|
+
transRpxRules: any
|
|
142
|
+
postcssInlineConfig: any
|
|
143
|
+
decodeHTMLText: boolean
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* native 文件专用配置
|
|
147
|
+
*/
|
|
148
|
+
i18n: any | null
|
|
149
|
+
checkUsingComponentsRules: any
|
|
150
|
+
forceDisableBuiltInLoader: boolean
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 默认的应用标题
|
|
154
|
+
*/
|
|
155
|
+
appTitle: string
|
|
156
|
+
|
|
157
|
+
attributes: any[]
|
|
158
|
+
externals: any[]
|
|
159
|
+
useRelativePath: boolean
|
|
160
|
+
removedChunks: any[]
|
|
161
|
+
forceProxyEventRules: any
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 若配置 disableRequireAsync=true,则全平台构建不支持异步分包
|
|
165
|
+
*/
|
|
166
|
+
supportRequireAsync: boolean
|
|
167
|
+
partialCompileRules: any
|
|
168
|
+
asyncSubpackageRules: any[]
|
|
169
|
+
transSubpackageRules: any
|
|
170
|
+
optimizeRenderRules: any[]
|
|
171
|
+
|
|
172
|
+
addEntryModuleIssuer: (module: string, issuer: string) => void
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 资源路径的哈希函数(用于生成输出唯一名)
|
|
176
|
+
*/
|
|
177
|
+
pathHash: (resourcePath: string) => string
|
|
178
|
+
|
|
179
|
+
// 缓存与工具
|
|
180
|
+
loaderContentCache: Map<string, any>
|
|
181
|
+
extractedFilesCache: Map<string, string>
|
|
182
|
+
|
|
183
|
+
// 函数接口
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 收集动态入口信息(分包、文件名、是否为页面、是否包含异步等)
|
|
187
|
+
*/
|
|
188
|
+
collectDynamicEntryInfo: (info: { resource: string; packageName: string; filename: string; entryType: string; hasAsync: boolean }) => void
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 添加入口(包装了 webpack 的 addEntry)
|
|
192
|
+
*/
|
|
193
|
+
addEntry: (request: string, name: string, callback: (err?: Error, result?: any) => void) => any
|
|
194
|
+
|
|
195
|
+
getModuleId: (filePath: string, isApp?: boolean) => string
|
|
196
|
+
getEntryNode: (module: any, type?: string) => any
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 根据资源路径和类型返回输出路径(支持自定义输出、冲突处理等)
|
|
200
|
+
*/
|
|
201
|
+
getOutputPath: (resourcePath: string, type: string, opts?: { ext?: string; conflictPath?: string }) => string
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 获取提取后的文件名(支持静态、插件、普通资源)
|
|
205
|
+
*/
|
|
206
|
+
getExtractedFile: (resource: string, opts?: { error?: (err: Error) => void }) => string
|
|
207
|
+
|
|
208
|
+
recordResourceMap: (params: {
|
|
209
|
+
resourcePath: string
|
|
210
|
+
resourceType: string
|
|
211
|
+
outputPath?: string
|
|
212
|
+
packageRoot?: string
|
|
213
|
+
recordOnly?: boolean
|
|
214
|
+
warn?: (e: Error) => void
|
|
215
|
+
error?: (e: Error) => void
|
|
216
|
+
}) => { outputPath?: string; alreadyOutputted?: boolean }
|
|
217
|
+
|
|
218
|
+
getPackageInfo: (params: {
|
|
219
|
+
resource: string
|
|
220
|
+
resourceType: string
|
|
221
|
+
outputPath?: string
|
|
222
|
+
issuerResource?: string
|
|
223
|
+
warn?: (e: Error) => void
|
|
224
|
+
error?: (e: Error) => void
|
|
225
|
+
}) => { packageName: string; packageRoot: string; outputPath?: string; alreadyOutputted?: boolean }
|
|
226
|
+
|
|
227
|
+
// 运行时信息与注入相关
|
|
228
|
+
runtimeInfo: Record<string, any>
|
|
229
|
+
dynamicSlotDependencies: Record<string, any>
|
|
230
|
+
dynamicTemplateRuleRunner: any
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 依据 package 注入到 mpx-custom-element-*.json 里面的组件路径
|
|
234
|
+
*/
|
|
235
|
+
getPackageInjectedComponentsMap: (packageName?: string) => Record<string, string>
|
|
236
|
+
|
|
237
|
+
getPackageInjectedTemplateConfig: (packageName?: string) => any
|
|
238
|
+
injectDynamicSlotDependencies: (usingComponents: string, resourcePath: string) => string
|
|
239
|
+
changeHashNameForAstNode: (templateAst: string, componentsMap: any) => string
|
|
240
|
+
collectDynamicSlotDependencies: (packageName?: string) => void
|
|
241
|
+
|
|
242
|
+
// 其它任意扩展字段
|
|
243
|
+
[key: string]: any
|
|
244
|
+
}
|
|
16
245
|
}
|
package/lib/index.js
CHANGED
|
@@ -87,6 +87,10 @@ const isProductionLikeMode = options => {
|
|
|
87
87
|
return options.mode === 'production' || !options.mode
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @param {import('webpack').NormalModule} module
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
90
94
|
const isStaticModule = module => {
|
|
91
95
|
if (!module.resource) return false
|
|
92
96
|
const { queryObj } = parseRequest(module.resource)
|
|
@@ -323,6 +327,9 @@ class MpxWebpackPlugin {
|
|
|
323
327
|
}
|
|
324
328
|
}
|
|
325
329
|
|
|
330
|
+
/**
|
|
331
|
+
* @param {import('webpack').Compiler} compiler
|
|
332
|
+
*/
|
|
326
333
|
apply (compiler) {
|
|
327
334
|
// 注入 fs 代理
|
|
328
335
|
startFSStripForCss(this.options.defs)
|
package/lib/loader.js
CHANGED
|
@@ -19,6 +19,10 @@ const processWeb = require('./web')
|
|
|
19
19
|
const processReact = require('./react')
|
|
20
20
|
const genMpxCustomElement = require('./runtime-render/gen-mpx-custom-element')
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @this {MpxLoaderContext<any>}
|
|
24
|
+
* @param {string} content
|
|
25
|
+
*/
|
|
22
26
|
module.exports = function (content) {
|
|
23
27
|
this.cacheable()
|
|
24
28
|
|
|
@@ -197,7 +197,7 @@ module.exports = function ({ print }) {
|
|
|
197
197
|
qa: qaPropLog
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
|
-
test: /^(lang|from-type|
|
|
200
|
+
test: /^(lang|from-type|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|phone-number-no-quota-toast|bindgetuserinfo|bindcontact|createliveactivity|bindgetphonenumber|bindgetrealtimephonenumber|binderror|bindopensetting|bindlaunchapp|bindchooseavatar|bindagreeprivacyauthorization)$/,
|
|
201
201
|
ios: iosPropLog,
|
|
202
202
|
android: androidPropLog,
|
|
203
203
|
harmony: harmonyPropLog
|
|
@@ -107,7 +107,7 @@ module.exports = function ({ print }) {
|
|
|
107
107
|
qa: qaPropLog
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
|
-
test: /^(always-embed|
|
|
110
|
+
test: /^(always-embed|safe-password-.+)$/,
|
|
111
111
|
ios: iosPropLog,
|
|
112
112
|
android: androidPropLog,
|
|
113
113
|
harmony: harmonyPropLog
|
|
@@ -93,7 +93,7 @@ module.exports = function ({ print }) {
|
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
test: /^(always-embed|
|
|
96
|
+
test: /^(always-embed|disable-default-padding|adjust-keyboard-to|fixed|show-confirm-bar)$/,
|
|
97
97
|
ios: iosPropLog,
|
|
98
98
|
android: androidPropLog,
|
|
99
99
|
harmony: harmonyPropLog
|
|
@@ -77,4 +77,3 @@ export declare const ScrollViewContext: import("react").Context<ScrollViewContex
|
|
|
77
77
|
export declare const PortalContext: import("react").Context<PortalContextValue>;
|
|
78
78
|
export declare const StickyContext: import("react").Context<StickyContextValue>;
|
|
79
79
|
export declare const ProviderContext: import("react").Context<null>;
|
|
80
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -5,4 +5,3 @@ export declare const getCustomEvent: (type: string | undefined, oe: any, { detai
|
|
|
5
5
|
}, props?: Props) => any;
|
|
6
6
|
declare const useInnerProps: (props?: Props, userRemoveProps?: RemoveProps, rawConfig?: RawConfig) => Record<string, (e: ExtendedNativeTouchEvent) => void> & Omit<Props, string>;
|
|
7
7
|
export default useInnerProps;
|
|
8
|
-
//# sourceMappingURL=getInnerListeners.d.ts.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
declare const _default: "<html><head>\n <meta content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scaleable=no\" name=\"viewport\">\n <style>\n html {\n -ms-content-zooming: none;\n -ms-touch-action: pan-x pan-y;\n }\n body {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n margin: 0;\n padding: 0;\n overflow: hidden;\n }\n * {\n user-select: none;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n }\n </style>\n </head>\n <body>\n <script>\n var scale = function (ratio) {\n return function (item) {\n if (typeof item === \"number\") {\n return item * ratio;\n }\n return item;\n };\n};\nfunction autoScaleCanvas(canvas) {\n var ctx = canvas.getContext(\"2d\");\n var ratio = window.devicePixelRatio || 1;\n if (ratio !== 1) {\n canvas.width *= ratio;\n canvas.height *= ratio;\n ctx.scale(ratio, ratio);\n ctx.isPointInPath = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return CanvasRenderingContext2D.prototype.isPointInPath.apply(ctx, args.map(scale(ratio)));\n };\n }\n return canvas;\n}\nwindow.autoScaleCanvas = autoScaleCanvas;\n</script>\n<script>\n\nvar WEBVIEW_TARGET = '@@WEBVIEW_TARGET';\n\nvar ID = function () {\n return Math.random().toString(32).slice(2);\n};\n\nvar flattenObjectCopyValue = function (flatObj, srcObj, key) {\n var value = srcObj[key];\n if (typeof value === 'function') {\n return;\n }\n if (typeof value === 'object' && value instanceof Node) {\n return;\n }\n flatObj[key] = flattenObject(value);\n};\n\nvar flattenObject = function (object) {\n if (typeof object !== 'object' || object === null) {\n return object;\n }\n // Handle TypedArray\n if (object instanceof Uint8ClampedArray) {\n return Array.from(object);\n }\n var flatObject = {};\n for (var key in object) {\n flattenObjectCopyValue(flatObject, object, key);\n }\n for (var key in Object.getOwnPropertyNames(object)) {\n flattenObjectCopyValue(flatObject, object, key);\n }\n return flatObject;\n};\n\nvar AutoScaledCanvas = function (element) {\n this.element = element;\n};\n\nAutoScaledCanvas.prototype.toDataURL = function () {\n return this.element.toDataURL.apply(this.element, arguments);\n};\n\nAutoScaledCanvas.prototype.autoScale = function () {\n if (this.savedHeight !== undefined) {\n this.element.height = this.savedHeight;\n }\n if (this.savedWidth !== undefined) {\n this.element.width = this.savedWidth;\n }\n window.autoScaleCanvas(this.element);\n};\n\nObject.defineProperty(AutoScaledCanvas.prototype, 'width', {\n get: function () {\n return this.element.width;\n },\n set: function (value) {\n this.savedWidth = value;\n this.autoScale();\n return value;\n },\n});\n\nObject.defineProperty(AutoScaledCanvas.prototype, 'height', {\n get: function () {\n return this.element.height;\n },\n set: function (value) {\n this.savedHeight = value;\n this.autoScale();\n return value;\n },\n});\nvar toMessage = function (result) {\n if (result instanceof Blob) {\n return {\n type: 'blob',\n payload: btoa(result),\n meta: {},\n };\n }\n if (result instanceof Object) {\n if (!result[WEBVIEW_TARGET]) {\n var id = ID();\n result[WEBVIEW_TARGET] = id;\n targets[id] = result;\n }\n return {\n type: 'json',\n payload: flattenObject(result),\n args: toArgs(flattenObject(result)),\n meta: {\n target: result[WEBVIEW_TARGET],\n constructor: result.__constructorName__ || result.constructor.name,\n },\n };\n }\n return {\n type: 'json',\n payload: typeof result === 'string' ? result : JSON.stringify(result),\n meta: {},\n };\n};\nvar toArgs = function (result) {\n var args = [];\n for (var key in result) {\n if (result[key] !== undefined && key !== '@@WEBVIEW_TARGET') {\n args.push(result[key]);\n }\n }\n return args;\n};\n\nvar createObjectsFromArgs = function (args) {\n for (var index = 0; index < args.length; index += 1) {\n var currentArg = args[index];\n if (currentArg && currentArg.className !== undefined) {\n var className = currentArg.className, classArgs = currentArg.classArgs;\n // new ImageData,第一个参数需要是 Uint8ClampedArray\n var object = new (Function.prototype.bind.apply(constructors[className], [null].concat(classArgs)))();\n args[index] = object;\n }\n }\n return args;\n};\n\nvar canvas = document.createElement('canvas');\ncanvas.style.width = '100%';\ncanvas.style.height = '100%';\nvar autoScaledCanvas = new AutoScaledCanvas(canvas);\n\nvar targets = {\n canvas: autoScaledCanvas,\n context2D: canvas.getContext('2d'),\n};\n\nvar constructors = {\n CanvasGradient: CanvasGradient,\n Image: Image,\n ImageData: ImageData,\n Uint8ClampedArray: Uint8ClampedArray,\n};\n\nImage.bind =\n Image.bind ||\n function () {\n return Image;\n };\n\nImageData.bind =\n ImageData.bind ||\n function () {\n return ImageData;\n };\nUint8ClampedArray.bind =\n Uint8ClampedArray.bind ||\n function () {\n return Uint8ClampedArray;\n };\n\nvar populateRefs = function (arg) {\n if (arg && arg.__ref__) {\n return targets[arg.__ref__];\n }\n return arg;\n};\ndocument.body.appendChild(canvas);\n\nvar mergeObjects = function (target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n return target;\n};\n\nfunction handleMessage(message) {\n var id = message.id,\n type = message.type,\n payload = message.payload;\n\n switch (type) {\n case 'exec': {\n var target = payload.target,\n method = payload.method,\n args = payload.args;\n var result = targets[target][method].apply(targets[target], args.map(populateRefs));\n var msg = toMessage(result);\n\n if (typeof result === 'object' && !msg.meta.constructor) {\n for (var constructorName in constructors) {\n if (result instanceof constructors[constructorName]) {\n msg.meta.constructor = constructorName;\n }\n }\n }\n window.ReactNativeWebView.postMessage(JSON.stringify(mergeObjects({ id: id }, msg)));\n break;\n }\n case 'set': {\n var target = payload.target,\n key = payload.key,\n value = payload.value;\n targets[target][key] = populateRefs(value);\n break;\n }\n case 'construct': {\n var constructor = payload.constructor,\n target = payload.id,\n args = payload.args || [];\n var newArgs = createObjectsFromArgs(args);\n var object;\n try {\n object = new (Function.prototype.bind.apply(constructors[constructor], [null].concat(newArgs)))();\n }\n catch (error) {\n throw new Error('Error while constructing '.concat(constructor, ' ').concat(error.message));\n }\n object.__constructorName__ = constructor;\n var msg = toMessage({});\n targets[target] = object;\n window.ReactNativeWebView.postMessage(JSON.stringify(mergeObjects({ id: id }, msg)));\n break;\n }\n case 'listen': {\n var types = payload.types,\n target = payload.target;\n for (var i = 0; i < types.length; i++) {\n var eventType = types[i];\n targets[target].addEventListener(eventType, function (e) {\n const message = toMessage({\n type: 'event',\n payload: {\n type: e.type,\n target: mergeObjects(flattenObject(targets[target]), {\n [WEBVIEW_TARGET]: target,\n }),\n },\n });\n window.ReactNativeWebView.postMessage(\n JSON.stringify(mergeObjects({ id: id }, message))\n );\n });\n }\n break;\n}\n }\n}\nvar handleError = function (err, message) {\n window.ReactNativeWebView.postMessage(JSON.stringify({\n id: message.id,\n type: 'error',\n payload: {\n message: err.message,\n stack: err.stack,\n },\n }));\n document.removeEventListener('message', handleIncomingMessage);\n};\n\nfunction handleIncomingMessage(data) {\n if (Array.isArray(data)) {\n for (var i = 0; i < data.length; i++) {\n try {\n handleMessage(data[i]);\n } catch (err) {\n handleError(err, data[i]);\n }\n }\n } else {\n try {\n handleMessage(data);\n } catch (err) {\n handleError(err, data);\n }\n }\n}\n\nwindow.mpxWebviewMessageCallback = handleIncomingMessage\n</script>\n \n\n</body></html>";
|
|
2
2
|
export default _default;
|
|
3
|
-
//# sourceMappingURL=html.d.ts.map
|
|
@@ -18,4 +18,3 @@ export interface CheckboxGroupProps {
|
|
|
18
18
|
}
|
|
19
19
|
declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HandlerRef<View, CheckboxGroupProps>>>;
|
|
20
20
|
export default CheckboxGroup;
|
|
21
|
-
//# sourceMappingURL=mpx-checkbox-group.d.ts.map
|
|
@@ -30,4 +30,3 @@ export interface CheckboxProps extends Selection {
|
|
|
30
30
|
}
|
|
31
31
|
declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HandlerRef<View, CheckboxProps>>>;
|
|
32
32
|
export default Checkbox;
|
|
33
|
-
//# sourceMappingURL=mpx-checkbox.d.ts.map
|
|
@@ -49,4 +49,3 @@ export interface PrivateInputProps {
|
|
|
49
49
|
type FinalInputProps = InputProps & PrivateInputProps;
|
|
50
50
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & PrivateInputProps & import("react").RefAttributes<HandlerRef<TextInput, FinalInputProps>>>;
|
|
51
51
|
export default Input;
|
|
52
|
-
//# sourceMappingURL=mpx-input.d.ts.map
|
|
@@ -144,11 +144,11 @@ const Input = forwardRef((props, ref) => {
|
|
|
144
144
|
};
|
|
145
145
|
const setKeyboardAvoidContext = () => {
|
|
146
146
|
if (keyboardAvoid) {
|
|
147
|
-
keyboardAvoid.current = { cursorSpacing, ref: nodeRef, adjustPosition, holdKeyboard };
|
|
148
147
|
keyboardAvoid.current = {
|
|
149
148
|
cursorSpacing,
|
|
150
149
|
ref: nodeRef,
|
|
151
150
|
adjustPosition,
|
|
151
|
+
holdKeyboard,
|
|
152
152
|
// fix: iOS 会在 onFocus 之前触发 keyboardWillShow 并且赋值 keyboardHeight
|
|
153
153
|
// 这里手动同步下 keyboardHeight,防止 onFocus setKeyboardAvoidContext 删掉 keyboardHeight
|
|
154
154
|
keyboardHeight: keyboardAvoid?.current?.keyboardHeight
|
|
@@ -15,8 +15,10 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
15
15
|
// 因此增加状态标记 + cancelAnimation 来优化
|
|
16
16
|
const isShow = useRef(false);
|
|
17
17
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
18
|
-
// translate/position top
|
|
19
|
-
|
|
18
|
+
// translate/position top+ overflow hidden 在 android 上时因为键盘顶起让页面高度变小,同时元素位置上移
|
|
19
|
+
// 此时最底部的区域是超出了页面高度的,hidden生效就被隐藏掉,因此需要 android 配置聚焦时禁用高度缩小
|
|
20
|
+
// margin-top 因为在 react-native 上和 flex 1 同时存在时,负值只会让容器高度整体变高,不会让元素上移
|
|
21
|
+
transform: [{ translateY: -offset.value }],
|
|
20
22
|
flexBasis: basic.value
|
|
21
23
|
}));
|
|
22
24
|
const resetKeyboard = () => {
|
|
@@ -18,4 +18,3 @@ interface MovableAreaProps {
|
|
|
18
18
|
}
|
|
19
19
|
declare const _MovableArea: import("react").ForwardRefExoticComponent<MovableAreaProps & import("react").RefAttributes<HandlerRef<View, MovableAreaProps>>>;
|
|
20
20
|
export default _MovableArea;
|
|
21
|
-
//# sourceMappingURL=mpx-movable-area.d.ts.map
|
|
@@ -63,4 +63,3 @@ interface MovableViewProps {
|
|
|
63
63
|
}
|
|
64
64
|
declare const _MovableView: import("react").ForwardRefExoticComponent<MovableViewProps & import("react").RefAttributes<HandlerRef<View, MovableViewProps>>>;
|
|
65
65
|
export default _MovableView;
|
|
66
|
-
//# sourceMappingURL=mpx-movable-view.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { DateProps } from './type';
|
|
|
4
4
|
import { HandlerRef } from '../useNodesRef';
|
|
5
5
|
declare const PickerDate: React.ForwardRefExoticComponent<Omit<DateProps, "ref"> & React.RefAttributes<HandlerRef<View, DateProps>>>;
|
|
6
6
|
export default PickerDate;
|
|
7
|
-
//# sourceMappingURL=date.d.ts.map
|
|
@@ -5,4 +5,3 @@ export declare const years: string[];
|
|
|
5
5
|
export declare const months: string[];
|
|
6
6
|
export declare const daysInMonthLength: (year: number, month: number) => 30 | 28 | 29 | 31;
|
|
7
7
|
export declare const daysInMonth: (year: number, month: number) => string[];
|
|
8
|
-
//# sourceMappingURL=dateData.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { HandlerRef } from '../useNodesRef';
|
|
|
4
4
|
import { PickerProps } from './type';
|
|
5
5
|
declare const Picker: React.ForwardRefExoticComponent<(Omit<import("./type").DateProps, "ref"> | Omit<import("./type").SelectorProps, "ref"> | Omit<import("./type").MultiSelectorProps, "ref"> | Omit<import("./type").TimeProps, "ref"> | Omit<import("./type").RegionProps, "ref">) & React.RefAttributes<HandlerRef<View, PickerProps>>>;
|
|
6
6
|
export default Picker;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { MultiSelectorProps } from './type';
|
|
|
4
4
|
import { HandlerRef } from '../useNodesRef';
|
|
5
5
|
declare const PickerMultiSelector: React.ForwardRefExoticComponent<Omit<MultiSelectorProps, "ref"> & React.RefAttributes<HandlerRef<View, MultiSelectorProps>>>;
|
|
6
6
|
export default PickerMultiSelector;
|
|
7
|
-
//# sourceMappingURL=multiSelector.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { RegionProps } from './type';
|
|
|
4
4
|
import { HandlerRef } from '../useNodesRef';
|
|
5
5
|
declare const PickerRegion: React.ForwardRefExoticComponent<Omit<RegionProps, "ref"> & React.RefAttributes<HandlerRef<View, RegionProps>>>;
|
|
6
6
|
export default PickerRegion;
|
|
7
|
-
//# sourceMappingURL=region.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { SelectorProps } from './type';
|
|
|
4
4
|
import { HandlerRef } from '../useNodesRef';
|
|
5
5
|
declare const PickerSelector: React.ForwardRefExoticComponent<Omit<SelectorProps, "ref"> & React.RefAttributes<HandlerRef<View, SelectorProps>>>;
|
|
6
6
|
export default PickerSelector;
|
|
7
|
-
//# sourceMappingURL=selector.d.ts.map
|
|
@@ -4,4 +4,3 @@ import { TimeProps } from './type';
|
|
|
4
4
|
import { HandlerRef } from '../useNodesRef';
|
|
5
5
|
declare const PickerTime: React.ForwardRefExoticComponent<Omit<TimeProps, "ref"> & React.RefAttributes<HandlerRef<View, TimeProps>>>;
|
|
6
6
|
export default PickerTime;
|
|
7
|
-
//# sourceMappingURL=time.d.ts.map
|
|
@@ -6,4 +6,3 @@ export declare const usePickerViewColumnAnimationContext: () => ContextValue;
|
|
|
6
6
|
export declare const PickerViewStyleContext: import("react").Context<Record<string, any> | undefined>;
|
|
7
7
|
export declare const usePickerViewStyleContext: () => Record<string, any> | undefined;
|
|
8
8
|
export {};
|
|
9
|
-
//# sourceMappingURL=pickerVIewContext.d.ts.map
|