@dcloudio/uni-cli-shared 2.0.2-4060620250520001 → 2.0.2-4070620250821001
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-fullscreen-video.vue +2 -2
- package/components/ad-interstitial.vue +2 -2
- package/components/ad-rewarded-video.vue +2 -2
- package/components/ad.mixin.mp-weixin.js +37 -21
- package/components/uniad.vue +4 -3
- 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/lib/util.js +2 -1
- package/package.json +2 -2
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<view @click="_onclick">
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
-
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
-
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
5
|
+
<uniad-plugin class="uniad-plugin" data-com-type="wx" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
+
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" data-com-type="wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
7
7
|
<!-- #endif -->
|
|
8
8
|
<!-- #ifdef MP-ALIPAY -->
|
|
9
9
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<view @click="_onclick">
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
-
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
-
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
5
|
+
<uniad-plugin class="uniad-plugin" data-com-type="wx" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
+
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" data-com-type="wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
7
7
|
<!-- #endif -->
|
|
8
8
|
<!-- #ifdef MP-ALIPAY -->
|
|
9
9
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<view @click="_onclick">
|
|
3
3
|
<slot :options="options" :loading="loading" :error="errorMessage" />
|
|
4
4
|
<!-- #ifdef MP-WEIXIN -->
|
|
5
|
-
<uniad-plugin class="uniad-plugin" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
-
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
5
|
+
<uniad-plugin class="uniad-plugin" data-com-type="wx" :adpid="adpid" :unit-id="unitId" @load="_onmpload" @close="_onmpclose" @error="_onmperror" @nextChannel="_onnextchannel"></uniad-plugin>
|
|
6
|
+
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" data-com-type="wx" @load="_onmpload" @close="_onmpclose" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
7
7
|
<!-- #endif -->
|
|
8
8
|
<!-- #ifdef MP-ALIPAY -->
|
|
9
9
|
<uniad-plugin class="uniad-plugin" :adpid="adpid" @create="_handleAdRef" @load="_onmpload" @close="_onmpclose" @error="_onmperror"></uniad-plugin>
|
|
@@ -64,7 +64,8 @@ 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
|
+
this._userInvokeShowFlag = false
|
|
68
69
|
this._providerType = ProviderType.ShanHu
|
|
69
70
|
if (this.preload && this._canCreateAd()) {
|
|
70
71
|
this.load()
|
|
@@ -85,7 +86,11 @@ export default {
|
|
|
85
86
|
},
|
|
86
87
|
|
|
87
88
|
show (e) {
|
|
88
|
-
this.errorMessage = null
|
|
89
|
+
this.errorMessage = null
|
|
90
|
+
if (this.loading) {
|
|
91
|
+
this._userInvokeShowFlag = true
|
|
92
|
+
return
|
|
93
|
+
}
|
|
89
94
|
if (this._providerType === ProviderType.ShanHu) {
|
|
90
95
|
this._showAdInPlugin(this.selectComponent('.uniad-plugin'))
|
|
91
96
|
} else if (this._providerType === ProviderType.WeChat) {
|
|
@@ -120,15 +125,22 @@ export default {
|
|
|
120
125
|
|
|
121
126
|
_onmpload (e) {
|
|
122
127
|
this.loading = false
|
|
123
|
-
this._dispatchEvent(EventType.Load, {})
|
|
128
|
+
this._dispatchEvent(EventType.Load, {})
|
|
129
|
+
if (this._userInvokeShowFlag) {
|
|
130
|
+
this._userInvokeShowFlag = false
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
this.show()
|
|
133
|
+
}, 1)
|
|
134
|
+
}
|
|
124
135
|
},
|
|
125
136
|
|
|
126
|
-
_onmpclose (e) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
const
|
|
137
|
+
_onmpclose (e) {
|
|
138
|
+
const detail = e.detail || e
|
|
139
|
+
this._dispatchEvent(EventType.Close, detail)
|
|
140
|
+
if (detail.adsdata) {
|
|
141
|
+
const adv = detail.adv
|
|
142
|
+
const adsdata = detail.adsdata
|
|
143
|
+
const version = detail.version
|
|
132
144
|
|
|
133
145
|
/* eslint-disable no-undef */
|
|
134
146
|
uniCloud.callFunction({
|
|
@@ -146,9 +158,9 @@ export default {
|
|
|
146
158
|
}
|
|
147
159
|
})
|
|
148
160
|
|
|
149
|
-
delete
|
|
150
|
-
delete
|
|
151
|
-
delete
|
|
161
|
+
delete detail.adv
|
|
162
|
+
delete detail.adsdata
|
|
163
|
+
delete detail.version
|
|
152
164
|
}
|
|
153
165
|
},
|
|
154
166
|
|
|
@@ -183,18 +195,18 @@ export default {
|
|
|
183
195
|
break
|
|
184
196
|
}
|
|
185
197
|
} else if (adData.provider === 10018) {
|
|
186
|
-
this._providerType = ProviderType.WeChat
|
|
198
|
+
this._providerType = ProviderType.WeChat
|
|
199
|
+
if (adData.tmpl_type === 24) {
|
|
200
|
+
this.customFullscreen = 'uni-ad-custom-fullscreen'
|
|
201
|
+
}
|
|
202
|
+
this.loading = true
|
|
187
203
|
this.selectComponent('.uniad-plugin-wx').setConfig(adData)
|
|
188
204
|
}
|
|
189
205
|
})
|
|
190
206
|
},
|
|
191
207
|
|
|
192
|
-
_onwxchannelerror (e) {
|
|
193
|
-
this.
|
|
194
|
-
this.$nextTick(() => {
|
|
195
|
-
this._providerType = ProviderType.ShanHu
|
|
196
|
-
this.selectComponent('.uniad-plugin').shanhuChannel()
|
|
197
|
-
})
|
|
208
|
+
_onwxchannelerror (e) {
|
|
209
|
+
this._dispatchEvent(EventType.Error, e.detail)
|
|
198
210
|
},
|
|
199
211
|
|
|
200
212
|
_dispatchEvent (type, data) {
|
|
@@ -313,7 +325,9 @@ export default {
|
|
|
313
325
|
if (res.isEnded && this._hasCallback()) {
|
|
314
326
|
this._callServer()
|
|
315
327
|
}
|
|
316
|
-
})
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
this._wxRewardedAd.load().then(() => { }).catch((_) => { })
|
|
317
331
|
|
|
318
332
|
this.loading = true
|
|
319
333
|
},
|
|
@@ -342,7 +356,9 @@ export default {
|
|
|
342
356
|
|
|
343
357
|
this._wxInterstitialAd.onClose(res => {
|
|
344
358
|
this._dispatchEvent(EventType.Close, res)
|
|
345
|
-
})
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
this._wxInterstitialAd.load().then(() => { }).catch((_) => { })
|
|
346
362
|
|
|
347
363
|
this.loading = true
|
|
348
364
|
},
|
package/components/uniad.vue
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
@nextChannel="_onnextchannel"
|
|
10
10
|
/>
|
|
11
11
|
<!-- #ifdef MP-WEIXIN -->
|
|
12
|
-
<ad-custom v-if="userwx" :unit-id="userUnitId" class="uni-ad-custom" :class="[customFullscreen]" @load="_onmpload" @error="_onmperror"></ad-custom>
|
|
13
|
-
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" @load="_onmpload" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
12
|
+
<ad-custom v-if="userwx" :unit-id="userUnitId" class="uni-ad-custom" data-com-type="wx" :class="[customFullscreen]" @load="_onmpload" @error="_onmperror"></ad-custom>
|
|
13
|
+
<uniad-plugin-wx v-if="wxchannel" class="uniad-plugin-wx" :class="[customFullscreen]" data-com-type="wx" @load="_onmpload" @error="_onwxchannelerror"></uniad-plugin-wx>
|
|
14
14
|
<!-- #endif -->
|
|
15
15
|
</view>
|
|
16
16
|
</template>
|
|
@@ -33,7 +33,8 @@ export default {
|
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<style>
|
|
36
|
-
.uni-ad-custom-fullscreen {
|
|
36
|
+
.uni-ad-custom-fullscreen {
|
|
37
|
+
display: flex;
|
|
37
38
|
height: 100vh;
|
|
38
39
|
}
|
|
39
40
|
</style>
|
|
@@ -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/lib/util.js
CHANGED
|
@@ -192,7 +192,8 @@ function showRunPrompt (delay = 300) {
|
|
|
192
192
|
clearTimeout(runPromptTimer)
|
|
193
193
|
}
|
|
194
194
|
runPromptTimer = setTimeout(() => {
|
|
195
|
-
|
|
195
|
+
const { runByHBuilderX } = require('./platform')
|
|
196
|
+
if (!runByHBuilderX) {
|
|
196
197
|
const chalk = require('chalk')
|
|
197
198
|
const outputDir = path.relative(
|
|
198
199
|
process.env.UNI_CLI_CONTEXT,
|
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-4070620250821001",
|
|
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": "83322ec9f7cc592b2052ff78370e12f4689f5966"
|
|
31
31
|
}
|