@dcloudio/vue-cli-plugin-uni 2.0.1-alpha-35520220824001 → 2.0.1-alpha-36020220830002
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/lib/mp/index.js +9 -2
- package/lib/mp/tips.js +67 -0
- package/package.json +3 -3
- package/packages/mp-vue/dist/mp.runtime.esm.js +379 -378
- package/packages/uni-cloud/dist/index.js +1 -1
- package/packages/uni-push/dist/uni-push.es.js +12 -16
- package/packages/uni-push/dist/uni-push.plus.es.js +0 -23
package/lib/mp/index.js
CHANGED
|
@@ -26,6 +26,8 @@ function createUniMPPlugin () {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const createWxMpIndependentPlugins = require('@dcloudio/uni-mp-weixin/lib/createIndependentPlugin')
|
|
29
|
+
|
|
30
|
+
const UniTips = require('./tips')
|
|
29
31
|
|
|
30
32
|
function getProvides () {
|
|
31
33
|
const uniPath = require('@dcloudio/uni-cli-shared/lib/platform').getMPRuntimePath()
|
|
@@ -190,7 +192,7 @@ module.exports = {
|
|
|
190
192
|
|
|
191
193
|
if ((process.env.UNI_SUBPACKGE || process.env.UNI_MP_PLUGIN) && process.env.UNI_SUBPACKGE !== 'main') {
|
|
192
194
|
plugins.push(new PreprocessAssetsPlugin())
|
|
193
|
-
}
|
|
195
|
+
}
|
|
194
196
|
|
|
195
197
|
{
|
|
196
198
|
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx';
|
|
@@ -228,7 +230,12 @@ ${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
|
|
|
228
230
|
}
|
|
229
231
|
if (process.env.NODE_ENV === 'production' || process.env.UNI_MINIMIZE === 'true') {
|
|
230
232
|
output.pathinfo = false
|
|
231
|
-
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (process.env.UNI_PLATFORM === 'mp-weixin' && process.env.NODE_ENV === 'production') {
|
|
236
|
+
plugins.push(new UniTips())
|
|
237
|
+
}
|
|
238
|
+
|
|
232
239
|
return {
|
|
233
240
|
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
|
234
241
|
entry () {
|
package/lib/mp/tips.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const {
|
|
4
|
+
isInHBuilderX
|
|
5
|
+
} = require('@dcloudio/uni-cli-shared')
|
|
6
|
+
|
|
7
|
+
class UniTips {
|
|
8
|
+
apply (compiler) {
|
|
9
|
+
compiler.hooks.emit.tap('PreprocessAssetsPlugin', compilation => {
|
|
10
|
+
const assets = compilation.assets
|
|
11
|
+
let hasAd = false
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
Object.keys(assets).forEach(name => {
|
|
15
|
+
if (hasAd) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!name.startsWith('common') && !name.startsWith('pages')) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const extname = path.extname(name)
|
|
24
|
+
if (extname !== '.js') {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!hasAd && !process.env.USE_UNI_AD) {
|
|
29
|
+
hasAd = assets[name]._value.match(/createRewardedVideoAd|createInterstitialAd/)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
if (hasAd) {
|
|
35
|
+
console.log(
|
|
36
|
+
'推荐使用uni-ad微信小程序版广告,无开通门槛、提前结算、插件丰富,助力广告变现。详情: https://uniapp.dcloud.net.cn/component/ad-weixin.html'
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let projectRoot = ''
|
|
41
|
+
if (isInHBuilderX) {
|
|
42
|
+
projectRoot = process.env.UNI_INPUT_DIR
|
|
43
|
+
} else {
|
|
44
|
+
projectRoot = process.env.UNI_CLI_CONTEXT
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const paths = fs.readdirSync(projectRoot)
|
|
48
|
+
const useUniCloud = paths.find((name) => {
|
|
49
|
+
return name.includes('uniCloud-')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
if (!useUniCloud && assets['project.config.json']) {
|
|
53
|
+
const pcjString = assets['project.config.json'].source()
|
|
54
|
+
const pcjJson = JSON.parse(pcjString)
|
|
55
|
+
if (typeof pcjJson.cloudfunctionRoot === 'string' && pcjJson.cloudfunctionRoot.length > 0) {
|
|
56
|
+
console.log(
|
|
57
|
+
'欢迎使用uniCloud,价格更便宜、开发更方便、生态更丰富的云开发。详情: https://uniapp.dcloud.net.cn/uniCloud/wx2unicloud.html'
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, 100)
|
|
62
|
+
} catch (e) {}
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = UniTips
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-uni",
|
|
3
|
-
"version": "2.0.1-alpha-
|
|
3
|
+
"version": "2.0.1-alpha-36020220830002",
|
|
4
4
|
"description": "uni-app plugin for vue-cli 3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "fxy060608",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dcloudio/uni-stat": "^2.0.1-alpha-
|
|
20
|
+
"@dcloudio/uni-stat": "^2.0.1-alpha-36020220830002",
|
|
21
21
|
"buffer-json": "^2.0.0",
|
|
22
22
|
"clone-deep": "^4.0.1",
|
|
23
23
|
"cross-env": "^5.2.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"copy-webpack-plugin": ">=5",
|
|
42
42
|
"postcss": ">=7"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "c3cd2073bb4e67dcb6d6a1ac9e98a461fc4ebd33"
|
|
45
45
|
}
|