@dcloudio/uni-cli-shared 2.0.2-4060620250520001 → 2.0.2-4070520250711001

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.
@@ -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
- this._dispatchEvent(EventType.Close, e.detail)
128
- if (e.detail.adsdata) {
129
- const adv = e.detail.adv
130
- const adsdata = e.detail.adsdata
131
- const version = e.detail.version
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 e.detail.adv
150
- delete e.detail.adsdata
151
- delete e.detail.version
161
+ delete detail.adv
162
+ delete detail.adsdata
163
+ delete detail.version
152
164
  }
153
165
  },
154
166
 
@@ -183,14 +195,19 @@ 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
208
  _onwxchannelerror (e) {
193
- this.wxchannel = false
209
+ this.wxchannel = false
210
+ this._dispatchEvent(EventType.Error, e.detail)
194
211
  this.$nextTick(() => {
195
212
  this._providerType = ProviderType.ShanHu
196
213
  this.selectComponent('.uniad-plugin').shanhuChannel()
@@ -313,7 +330,9 @@ export default {
313
330
  if (res.isEnded && this._hasCallback()) {
314
331
  this._callServer()
315
332
  }
316
- })
333
+ })
334
+
335
+ this._wxRewardedAd.load().then(() => { }).catch((_) => { })
317
336
 
318
337
  this.loading = true
319
338
  },
@@ -342,7 +361,9 @@ export default {
342
361
 
343
362
  this._wxInterstitialAd.onClose(res => {
344
363
  this._dispatchEvent(EventType.Close, res)
345
- })
364
+ })
365
+
366
+ this._wxInterstitialAd.load().then(() => { }).catch((_) => { })
346
367
 
347
368
  this.loading = true
348
369
  },
@@ -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
+ }
package/lib/util.js CHANGED
@@ -192,7 +192,8 @@ function showRunPrompt (delay = 300) {
192
192
  clearTimeout(runPromptTimer)
193
193
  }
194
194
  runPromptTimer = setTimeout(() => {
195
- if (!isInHBuilderX) {
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-4060620250520001",
3
+ "version": "2.0.2-4070520250711001",
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": "f8e1b7ce5a0f6b98e42e137b04287b99fafa51e8"
30
+ "gitHead": "1cfce22ea63bfcf84c9f9f26df4a5c144286c756"
31
31
  }