@dcloudio/uni-cli-shared 2.0.2-alpha-4070520250704001 → 2.0.2-alpha-4070520250704002
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/components/ad.mixin.mp-weixin.js +29 -29
- package/lib/preprocessor/index.js +61 -0
- package/lib/preprocessor/preprocessor-macos-arm64.node +0 -0
- package/lib/preprocessor/preprocessor-macos-x86_64.node +0 -0
- package/lib/preprocessor/preprocessor-windows-x86_64.node +0 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-undef */
|
|
1
|
+
/* eslint-disable no-undef */
|
|
2
2
|
const adPlugin = requirePlugin('uni-ad')
|
|
3
3
|
|
|
4
4
|
const EventType = {
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
return {
|
|
55
55
|
loading: false,
|
|
56
56
|
userwx: false,
|
|
57
|
-
userUnitId: '',
|
|
57
|
+
userUnitId: '',
|
|
58
58
|
customFullscreen: '',
|
|
59
59
|
wxchannel: false,
|
|
60
60
|
errorMessage: null
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
this._ad = null
|
|
65
65
|
this._loading = false
|
|
66
66
|
this._wxRewardedAd = null
|
|
67
|
-
this._wxInterstitialAd = null
|
|
67
|
+
this._wxInterstitialAd = null
|
|
68
68
|
this._userInvokeShowFlag = false
|
|
69
69
|
this._providerType = ProviderType.ShanHu
|
|
70
70
|
if (this.preload && this._canCreateAd()) {
|
|
@@ -86,10 +86,10 @@ export default {
|
|
|
86
86
|
},
|
|
87
87
|
|
|
88
88
|
show (e) {
|
|
89
|
-
this.errorMessage = null
|
|
90
|
-
if (this.loading) {
|
|
91
|
-
this._userInvokeShowFlag = true
|
|
92
|
-
return
|
|
89
|
+
this.errorMessage = null
|
|
90
|
+
if (this.loading) {
|
|
91
|
+
this._userInvokeShowFlag = true
|
|
92
|
+
return
|
|
93
93
|
}
|
|
94
94
|
if (this._providerType === ProviderType.ShanHu) {
|
|
95
95
|
this._showAdInPlugin(this.selectComponent('.uniad-plugin'))
|
|
@@ -125,16 +125,16 @@ export default {
|
|
|
125
125
|
|
|
126
126
|
_onmpload (e) {
|
|
127
127
|
this.loading = false
|
|
128
|
-
this._dispatchEvent(EventType.Load, {})
|
|
129
|
-
if (this._userInvokeShowFlag) {
|
|
130
|
-
this._userInvokeShowFlag = false
|
|
131
|
-
setTimeout(() => {
|
|
132
|
-
this.show()
|
|
133
|
-
}, 1)
|
|
128
|
+
this._dispatchEvent(EventType.Load, {})
|
|
129
|
+
if (this._userInvokeShowFlag) {
|
|
130
|
+
this._userInvokeShowFlag = false
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
this.show()
|
|
133
|
+
}, 1)
|
|
134
134
|
}
|
|
135
135
|
},
|
|
136
136
|
|
|
137
|
-
_onmpclose (e) {
|
|
137
|
+
_onmpclose (e) {
|
|
138
138
|
const detail = e.detail || e
|
|
139
139
|
this._dispatchEvent(EventType.Close, detail)
|
|
140
140
|
if (detail.adsdata) {
|
|
@@ -180,9 +180,9 @@ export default {
|
|
|
180
180
|
case 4:
|
|
181
181
|
this.wxAdType = AdType.Banner
|
|
182
182
|
this.userwx = true
|
|
183
|
-
this.userUnitId = adData.posid
|
|
184
|
-
if (adData.tmpl_type === 24) {
|
|
185
|
-
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
183
|
+
this.userUnitId = adData.posid
|
|
184
|
+
if (adData.tmpl_type === 24) {
|
|
185
|
+
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
186
186
|
}
|
|
187
187
|
break
|
|
188
188
|
case 9:
|
|
@@ -195,10 +195,10 @@ export default {
|
|
|
195
195
|
break
|
|
196
196
|
}
|
|
197
197
|
} else if (adData.provider === 10018) {
|
|
198
|
-
this._providerType = ProviderType.WeChat
|
|
199
|
-
if (adData.tmpl_type === 24) {
|
|
200
|
-
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
201
|
-
}
|
|
198
|
+
this._providerType = ProviderType.WeChat
|
|
199
|
+
if (adData.tmpl_type === 24) {
|
|
200
|
+
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
201
|
+
}
|
|
202
202
|
this.loading = true
|
|
203
203
|
this.selectComponent('.uniad-plugin-wx').setConfig(adData)
|
|
204
204
|
}
|
|
@@ -206,7 +206,7 @@ export default {
|
|
|
206
206
|
},
|
|
207
207
|
|
|
208
208
|
_onwxchannelerror (e) {
|
|
209
|
-
this.wxchannel = false
|
|
209
|
+
this.wxchannel = false
|
|
210
210
|
this._dispatchEvent(EventType.Error, e.detail)
|
|
211
211
|
this.$nextTick(() => {
|
|
212
212
|
this._providerType = ProviderType.ShanHu
|
|
@@ -277,7 +277,7 @@ export default {
|
|
|
277
277
|
case AdType.RewardedVideo:
|
|
278
278
|
if (!this._wxRewardedAd) {
|
|
279
279
|
return
|
|
280
|
-
}
|
|
280
|
+
}
|
|
281
281
|
// eslint-disable-next-line handle-callback-err
|
|
282
282
|
this._wxRewardedAd.show().catch((err) => {
|
|
283
283
|
this._wxRewardedAd.load().then(() => {
|
|
@@ -290,7 +290,7 @@ export default {
|
|
|
290
290
|
case AdType.Interstitial:
|
|
291
291
|
if (!this._wxInterstitialAd) {
|
|
292
292
|
return
|
|
293
|
-
}
|
|
293
|
+
}
|
|
294
294
|
// eslint-disable-next-line handle-callback-err
|
|
295
295
|
this._wxInterstitialAd.show().catch((err) => {
|
|
296
296
|
this._wxInterstitialAd.load().then(() => {
|
|
@@ -325,13 +325,13 @@ export default {
|
|
|
325
325
|
this._dispatchEvent(EventType.Error, err)
|
|
326
326
|
})
|
|
327
327
|
|
|
328
|
-
this._wxRewardedAd.onClose(res => {
|
|
328
|
+
this._wxRewardedAd.onClose(res => {
|
|
329
329
|
this._dispatchEvent(EventType.Close, res)
|
|
330
330
|
if (res.isEnded && this._hasCallback()) {
|
|
331
331
|
this._callServer()
|
|
332
332
|
}
|
|
333
|
-
})
|
|
334
|
-
|
|
333
|
+
})
|
|
334
|
+
|
|
335
335
|
this._wxRewardedAd.load().then(() => { }).catch((_) => { })
|
|
336
336
|
|
|
337
337
|
this.loading = true
|
|
@@ -361,8 +361,8 @@ export default {
|
|
|
361
361
|
|
|
362
362
|
this._wxInterstitialAd.onClose(res => {
|
|
363
363
|
this._dispatchEvent(EventType.Close, res)
|
|
364
|
-
})
|
|
365
|
-
|
|
364
|
+
})
|
|
365
|
+
|
|
366
366
|
this._wxInterstitialAd.load().then(() => { }).catch((_) => { })
|
|
367
367
|
|
|
368
368
|
this.loading = true
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function resolveNativeBinding () {
|
|
2
|
+
const { platform, arch } = process
|
|
3
|
+
let nativeBinding = ''
|
|
4
|
+
switch (platform) {
|
|
5
|
+
case 'win32':
|
|
6
|
+
switch (arch) {
|
|
7
|
+
case 'x64':
|
|
8
|
+
nativeBinding = 'preprocessor-windows-x86_64'
|
|
9
|
+
break
|
|
10
|
+
default:
|
|
11
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
12
|
+
}
|
|
13
|
+
break
|
|
14
|
+
case 'darwin':
|
|
15
|
+
switch (arch) {
|
|
16
|
+
case 'x64':
|
|
17
|
+
nativeBinding = 'preprocessor-macos-x86_64'
|
|
18
|
+
break
|
|
19
|
+
case 'arm64':
|
|
20
|
+
nativeBinding = 'preprocessor-macos-arm64'
|
|
21
|
+
break
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
24
|
+
}
|
|
25
|
+
break
|
|
26
|
+
default:
|
|
27
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
28
|
+
}
|
|
29
|
+
return require('./' + nativeBinding)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function runProcess (vue3 = false) {
|
|
33
|
+
try {
|
|
34
|
+
/* eslint-disable no-undef */
|
|
35
|
+
globalThis.preprocessor_require = require
|
|
36
|
+
await resolveNativeBinding().process(vue3)
|
|
37
|
+
} catch (error) {
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class PreprocessorWebpackPlugin {
|
|
42
|
+
apply (compiler) {
|
|
43
|
+
compiler.hooks.afterEmit.tapPromise('d', (params) => {
|
|
44
|
+
return runProcess(false)
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function PreprocessorVitePlugin () {
|
|
50
|
+
return {
|
|
51
|
+
name: 'preprocessor',
|
|
52
|
+
async writeBundle (_) {
|
|
53
|
+
await runProcess(true)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = {
|
|
59
|
+
PreprocessorWebpackPlugin,
|
|
60
|
+
PreprocessorVitePlugin
|
|
61
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-alpha-
|
|
3
|
+
"version": "2.0.2-alpha-4070520250704002",
|
|
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": "41a563d925b63775d13a869cfbd24f9d0e269a27"
|
|
31
31
|
}
|