1
1
const fs = require ( 'fs' )
2
2
const path = require ( 'path' )
3
+ const updateComponents = require ( './component' )
3
4
4
5
const tmpDir = path . resolve ( __dirname , '../../.tmp' )
5
6
@@ -72,6 +73,12 @@ function updateAppComponents(paths) {
72
73
return updateExportDefaultObject ( paths , 'app-components.js' , false )
73
74
}
74
75
76
+ function updateCoreComponents ( paths ) {
77
+ const tags = process . UNI_TAGS || new Set ( )
78
+ Object . keys ( paths ) . forEach ( tag => tags . add ( tag . replace ( / ( [ a - z ] ) ( [ A - Z ] ) / g, '$1-$2' ) . toLowerCase ( ) ) )
79
+ updateComponents ( tags )
80
+ }
81
+
75
82
function updateAppMixins ( paths ) {
76
83
return updateExportDefaultObject ( paths , 'app-mixins.js' , false , true )
77
84
}
@@ -93,6 +100,11 @@ const isAppComponents = filepath => {
93
100
filepath . indexOf ( '/platforms/' + process . env . UNI_PLATFORM + '/components/app/' ) === 0
94
101
}
95
102
103
+ const isCoreComponents = filepath => {
104
+ return path . extname ( filepath ) === '.vue' &&
105
+ filepath . indexOf ( '/core/view/components/' ) === 0
106
+ }
107
+
96
108
const isAppMixins = filepath => {
97
109
return path . extname ( filepath ) === '.js' &&
98
110
filepath . indexOf ( '/platforms/' + process . env . UNI_PLATFORM + '/components/app/' ) === 0
@@ -113,6 +125,7 @@ function parseDeps(apis, manifest) {
113
125
const apiProtocolPaths = Object . create ( null )
114
126
const invokeApiPaths = Object . create ( null )
115
127
const appComponentsPaths = Object . create ( null )
128
+ const coreComponentsPaths = Object . create ( null )
116
129
const appMixinsPaths = Object . create ( null )
117
130
const systemRoutesPaths = Object . create ( null )
118
131
const apiSubscribePaths = Object . create ( null )
@@ -126,6 +139,9 @@ function parseDeps(apis, manifest) {
126
139
} , {
127
140
test : isAppComponents ,
128
141
paths : appComponentsPaths
142
+ } , {
143
+ test : isCoreComponents ,
144
+ paths : coreComponentsPaths
129
145
} , {
130
146
test : isAppMixins ,
131
147
paths : appMixinsPaths
@@ -159,7 +175,7 @@ function parseDeps(apis, manifest) {
159
175
} )
160
176
if ( strategy ) {
161
177
strategy . paths [ exports ] = filepath
162
- } else {
178
+ } else {
163
179
console . log ( 'dep' , name , dep )
164
180
console . warn ( `${ filepath } 未识别` )
165
181
}
@@ -175,6 +191,7 @@ function parseDeps(apis, manifest) {
175
191
apiProtocolPaths,
176
192
invokeApiPaths,
177
193
appComponentsPaths,
194
+ coreComponentsPaths,
178
195
appMixinsPaths,
179
196
systemRoutesPaths,
180
197
apiSubscribePaths
@@ -203,6 +220,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
203
220
invokeApiPaths,
204
221
apiSubscribePaths,
205
222
appComponentsPaths,
223
+ coreComponentsPaths,
206
224
appMixinsPaths,
207
225
systemRoutesPaths
208
226
} = parseDeps ( apis , manifest )
@@ -214,6 +232,7 @@ module.exports = function updateApis(apis = new Set(), userApis = new Set()) {
214
232
updateInvokeApi ( invokeApiPaths )
215
233
216
234
updateAppComponents ( appComponentsPaths )
235
+ updateCoreComponents ( coreComponentsPaths )
217
236
updateAppMixins ( appMixinsPaths )
218
237
updateSystemRoutes ( systemRoutesPaths )
219
- }
238
+ }
0 commit comments