@dcloudio/uni-cli-shared 2.0.2-4070520250711001 → 2.0.2-4080420251103001
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.
|
@@ -70,6 +70,7 @@ export default {
|
|
|
70
70
|
if (this.preload && this._canCreateAd()) {
|
|
71
71
|
this.load()
|
|
72
72
|
}
|
|
73
|
+
this._dispatchEvent('adcreated', { instance: this })
|
|
73
74
|
},
|
|
74
75
|
methods: {
|
|
75
76
|
load () {
|
|
@@ -199,19 +200,17 @@ export default {
|
|
|
199
200
|
if (adData.tmpl_type === 24) {
|
|
200
201
|
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
201
202
|
}
|
|
202
|
-
this.loading = true
|
|
203
|
+
this.loading = true
|
|
204
|
+
if (!adData.dcloudAdpid) {
|
|
205
|
+
adData.dcloudAdpid = this.adpid
|
|
206
|
+
}
|
|
203
207
|
this.selectComponent('.uniad-plugin-wx').setConfig(adData)
|
|
204
208
|
}
|
|
205
209
|
})
|
|
206
210
|
},
|
|
207
211
|
|
|
208
|
-
_onwxchannelerror (e) {
|
|
209
|
-
this.
|
|
210
|
-
this._dispatchEvent(EventType.Error, e.detail)
|
|
211
|
-
this.$nextTick(() => {
|
|
212
|
-
this._providerType = ProviderType.ShanHu
|
|
213
|
-
this.selectComponent('.uniad-plugin').shanhuChannel()
|
|
214
|
-
})
|
|
212
|
+
_onwxchannelerror (e) {
|
|
213
|
+
this._dispatchEvent(EventType.Error, e.detail || e)
|
|
215
214
|
},
|
|
216
215
|
|
|
217
216
|
_dispatchEvent (type, data) {
|
|
@@ -229,14 +228,18 @@ export default {
|
|
|
229
228
|
iv,
|
|
230
229
|
version,
|
|
231
230
|
expireTime
|
|
232
|
-
}) => {
|
|
231
|
+
}) => {
|
|
232
|
+
const uniOptions = {
|
|
233
|
+
adpid: this.adpid
|
|
234
|
+
}
|
|
233
235
|
adComponent.show({
|
|
234
236
|
userId: this.urlCallback.userId || '',
|
|
235
237
|
extra: this.urlCallback.extra || '',
|
|
236
238
|
encryptKey,
|
|
237
239
|
iv,
|
|
238
240
|
version,
|
|
239
|
-
expireTime
|
|
241
|
+
expireTime,
|
|
242
|
+
uniOptions
|
|
240
243
|
})
|
|
241
244
|
},
|
|
242
245
|
fail: (err) => {
|
|
@@ -255,12 +258,16 @@ export default {
|
|
|
255
258
|
switch (this.wxAdType) {
|
|
256
259
|
case AdType.RewardedVideo:
|
|
257
260
|
if (this._wxRewardedAd) {
|
|
258
|
-
this._wxRewardedAd.load()
|
|
261
|
+
this._wxRewardedAd.load().catch((err) => {
|
|
262
|
+
this._dispatchEvent(EventType.Error, err)
|
|
263
|
+
})
|
|
259
264
|
}
|
|
260
265
|
break
|
|
261
266
|
case AdType.Interstitial:
|
|
262
267
|
if (this._wxInterstitialAd) {
|
|
263
|
-
this._wxInterstitialAd.load()
|
|
268
|
+
this._wxInterstitialAd.load().catch((err) => {
|
|
269
|
+
this._dispatchEvent(EventType.Error, err)
|
|
270
|
+
})
|
|
264
271
|
}
|
|
265
272
|
break
|
|
266
273
|
}
|
|
@@ -280,11 +287,7 @@ export default {
|
|
|
280
287
|
}
|
|
281
288
|
// eslint-disable-next-line handle-callback-err
|
|
282
289
|
this._wxRewardedAd.show().catch((err) => {
|
|
283
|
-
this.
|
|
284
|
-
this._wxRewardedAd.show()
|
|
285
|
-
}).catch((err) => {
|
|
286
|
-
this._dispatchEvent(EventType.Error, err)
|
|
287
|
-
})
|
|
290
|
+
this._dispatchEvent(EventType.Error, err)
|
|
288
291
|
})
|
|
289
292
|
break
|
|
290
293
|
case AdType.Interstitial:
|
|
@@ -293,11 +296,7 @@ export default {
|
|
|
293
296
|
}
|
|
294
297
|
// eslint-disable-next-line handle-callback-err
|
|
295
298
|
this._wxInterstitialAd.show().catch((err) => {
|
|
296
|
-
this.
|
|
297
|
-
this._wxInterstitialAd.show()
|
|
298
|
-
}).catch((err) => {
|
|
299
|
-
this._dispatchEvent(EventType.Error, err)
|
|
300
|
-
})
|
|
299
|
+
this._dispatchEvent(EventType.Error, err)
|
|
301
300
|
})
|
|
302
301
|
break
|
|
303
302
|
}
|
|
@@ -321,7 +320,8 @@ export default {
|
|
|
321
320
|
})
|
|
322
321
|
|
|
323
322
|
this._wxRewardedAd.onError(err => {
|
|
324
|
-
this.loading = false
|
|
323
|
+
this.loading = false
|
|
324
|
+
this.errorMessage = JSON.stringify(err)
|
|
325
325
|
this._dispatchEvent(EventType.Error, err)
|
|
326
326
|
})
|
|
327
327
|
|
|
@@ -332,7 +332,9 @@ export default {
|
|
|
332
332
|
}
|
|
333
333
|
})
|
|
334
334
|
|
|
335
|
-
this._wxRewardedAd.load().then(() => {
|
|
335
|
+
this._wxRewardedAd.load().then(() => {
|
|
336
|
+
}).catch((_) => {
|
|
337
|
+
})
|
|
336
338
|
|
|
337
339
|
this.loading = true
|
|
338
340
|
},
|
|
@@ -350,12 +352,15 @@ export default {
|
|
|
350
352
|
this._dispatchEvent(EventType.Load, {})
|
|
351
353
|
if (this._userInvokeShowFlag) {
|
|
352
354
|
this._userInvokeShowFlag = false
|
|
353
|
-
this._wxInterstitialAd.show()
|
|
355
|
+
this._wxInterstitialAd.show().catch((err) => {
|
|
356
|
+
this._dispatchEvent(EventType.Error, err)
|
|
357
|
+
})
|
|
354
358
|
}
|
|
355
359
|
})
|
|
356
360
|
|
|
357
361
|
this._wxInterstitialAd.onError(err => {
|
|
358
|
-
this.loading = false
|
|
362
|
+
this.loading = false
|
|
363
|
+
this.errorMessage = JSON.stringify(err)
|
|
359
364
|
this._dispatchEvent(EventType.Error, err)
|
|
360
365
|
})
|
|
361
366
|
|
|
@@ -363,7 +368,9 @@ export default {
|
|
|
363
368
|
this._dispatchEvent(EventType.Close, res)
|
|
364
369
|
})
|
|
365
370
|
|
|
366
|
-
this._wxInterstitialAd.load().
|
|
371
|
+
this._wxInterstitialAd.load().catch((err) => {
|
|
372
|
+
this._dispatchEvent(EventType.Error, err)
|
|
373
|
+
})
|
|
367
374
|
|
|
368
375
|
this.loading = true
|
|
369
376
|
},
|
|
@@ -389,6 +396,10 @@ export default {
|
|
|
389
396
|
this._dispatchEvent(EventType.Error, err)
|
|
390
397
|
}
|
|
391
398
|
})
|
|
399
|
+
},
|
|
400
|
+
|
|
401
|
+
toJSON () {
|
|
402
|
+
return ''
|
|
392
403
|
}
|
|
393
404
|
}
|
|
394
405
|
}
|
package/components/page-meta.vue
CHANGED
|
@@ -64,8 +64,9 @@ export default {
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
created () {
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const pages = getCurrentPages()
|
|
68
|
+
const currentPage = pages[pages.length - 1]
|
|
69
|
+
this.$pageVm = currentPage.$vm || currentPage
|
|
69
70
|
// event
|
|
70
71
|
// h5 暂不支持生命周期 onResize,补充后,可以移除该条件编译
|
|
71
72
|
// #ifdef H5
|
|
@@ -84,7 +85,7 @@ export default {
|
|
|
84
85
|
})
|
|
85
86
|
|
|
86
87
|
// #ifdef APP-PLUS
|
|
87
|
-
this._currentWebview =
|
|
88
|
+
this._currentWebview = currentPage.$getAppWebview()
|
|
88
89
|
if (this.enablePullDownRefresh) {
|
|
89
90
|
this.setPullDownRefresh(this._currentWebview, true)
|
|
90
91
|
}
|
|
@@ -102,7 +103,7 @@ export default {
|
|
|
102
103
|
this.rootFontSize,
|
|
103
104
|
this.pageStyle
|
|
104
105
|
], () => {
|
|
105
|
-
this.setPageMeta()
|
|
106
|
+
this.setPageMeta(currentPage.$page.id)
|
|
106
107
|
})
|
|
107
108
|
this.$watch(() => [
|
|
108
109
|
this.backgroundColor,
|
|
@@ -128,6 +129,11 @@ export default {
|
|
|
128
129
|
mounted () {
|
|
129
130
|
this.scrollTop && this.pageScrollTo()
|
|
130
131
|
},
|
|
132
|
+
// #ifdef H5
|
|
133
|
+
activated () {
|
|
134
|
+
this.setPageMeta()
|
|
135
|
+
},
|
|
136
|
+
// #endif
|
|
131
137
|
methods: {
|
|
132
138
|
setPullDownRefresh (webview, enabled) {
|
|
133
139
|
webview.setStyle({
|
|
@@ -137,12 +143,15 @@ export default {
|
|
|
137
143
|
}
|
|
138
144
|
})
|
|
139
145
|
},
|
|
140
|
-
setPageMeta () {
|
|
146
|
+
setPageMeta (pageId) {
|
|
141
147
|
// h5 和 app-plus 设置 rootFontSize
|
|
142
148
|
// #ifdef H5 || APP-PLUS
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
149
|
+
this.$nextTick(() => {
|
|
150
|
+
uni.setPageMeta({
|
|
151
|
+
pageStyle: this.pageStyle,
|
|
152
|
+
rootFontSize: this.rootFontSize,
|
|
153
|
+
pageId
|
|
154
|
+
})
|
|
146
155
|
})
|
|
147
156
|
// #endif
|
|
148
157
|
},
|
|
Binary file
|
|
Binary file
|
package/lib/uts/uts-loader.js
CHANGED
|
@@ -59,12 +59,36 @@ function createUniModulesSyncFilePreprocessor (
|
|
|
59
59
|
} else if (extname === '.uts' || extname === '.ts') {
|
|
60
60
|
return preJs(content)
|
|
61
61
|
} else if (extname === '.uvue' || extname === '.vue') {
|
|
62
|
-
return preJs(preHtml(content))
|
|
62
|
+
return preUTSSDKVueFile(fileName, preJs(preHtml(content)))
|
|
63
63
|
}
|
|
64
64
|
return content
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
function preUTSSDKVueFile (filename, content) {
|
|
69
|
+
if (
|
|
70
|
+
filename.includes('utssdk') &&
|
|
71
|
+
(filename.includes('app-android') || filename.includes('app-ios'))
|
|
72
|
+
) {
|
|
73
|
+
const {
|
|
74
|
+
parseComponent
|
|
75
|
+
} = require('vue-template-compiler')
|
|
76
|
+
const descriptor = parseComponent(content, {
|
|
77
|
+
sourceMap: false,
|
|
78
|
+
pad: 'line'
|
|
79
|
+
})
|
|
80
|
+
if (descriptor.script?.content) {
|
|
81
|
+
return (
|
|
82
|
+
descriptor.script.content +
|
|
83
|
+
// 补充 template 内容
|
|
84
|
+
`/*${descriptor.template?.content}*/`
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
return content
|
|
88
|
+
}
|
|
89
|
+
return content
|
|
90
|
+
}
|
|
91
|
+
|
|
68
92
|
function once (fn, ctx = null) {
|
|
69
93
|
let res
|
|
70
94
|
return (...args) => {
|
|
@@ -96,7 +120,8 @@ module.exports = async function (content) {
|
|
|
96
120
|
|
|
97
121
|
const {
|
|
98
122
|
syncUniModuleFilesByCompiler,
|
|
99
|
-
resolveTscUniModuleIndexFileName
|
|
123
|
+
resolveTscUniModuleIndexFileName,
|
|
124
|
+
resolveTscUniModuleUTSSDKVueFileNames
|
|
100
125
|
} = resolveUTSCompiler()
|
|
101
126
|
|
|
102
127
|
const compilePlugin = async (pluginDir) => {
|
|
@@ -124,27 +149,44 @@ module.exports = async function (content) {
|
|
|
124
149
|
)
|
|
125
150
|
}
|
|
126
151
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
152
|
+
// 不判重了,不然nvue,vue并发同一个插件时,其中一个会跳过tsc编译,直接走到rust那里,导致一些文件还没有生成,比如vue兼容模式组件之类的
|
|
153
|
+
// if (!utsPlugins.has(pluginId)) {
|
|
154
|
+
utsPlugins.add(pluginId)
|
|
155
|
+
if (uniXKotlinCompiler) {
|
|
156
|
+
const platform = 'app-android'
|
|
157
|
+
const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
|
|
158
|
+
platform,
|
|
159
|
+
pluginDir
|
|
160
|
+
)
|
|
161
|
+
for (const vueFile of vueFiles) {
|
|
162
|
+
await uniXKotlinCompiler.addRootFile(vueFile)
|
|
137
163
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
164
|
+
const indexFileName = resolveTscUniModuleIndexFileName(
|
|
165
|
+
platform,
|
|
166
|
+
pluginDir
|
|
167
|
+
)
|
|
168
|
+
if (indexFileName) {
|
|
169
|
+
await uniXKotlinCompiler.addRootFile(indexFileName)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (uniXSwiftCompiler) {
|
|
173
|
+
const platform = 'app-ios'
|
|
174
|
+
const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
|
|
175
|
+
platform,
|
|
176
|
+
pluginDir
|
|
177
|
+
)
|
|
178
|
+
for (const vueFile of vueFiles) {
|
|
179
|
+
await uniXSwiftCompiler.addRootFile(vueFile)
|
|
180
|
+
}
|
|
181
|
+
const indexFileName = resolveTscUniModuleIndexFileName(
|
|
182
|
+
platform,
|
|
183
|
+
pluginDir
|
|
184
|
+
)
|
|
185
|
+
if (indexFileName) {
|
|
186
|
+
await uniXSwiftCompiler.addRootFile(indexFileName)
|
|
146
187
|
}
|
|
147
188
|
}
|
|
189
|
+
// }
|
|
148
190
|
|
|
149
191
|
// 处理uni_modules中的文件变更
|
|
150
192
|
const files = changedFiles.get(pluginId)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-4080420251103001",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"postcss-urlrewrite": "^0.2.2",
|
|
28
28
|
"strip-json-comments": "^2.0.1"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "45cefdc25bd7f68367e86074eb16962b0cb8221d"
|
|
31
31
|
}
|