@dcloudio/uni-cli-shared 2.0.1-34920220609002 → 2.0.1-35320220729002
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/index.js +7 -5
- package/lib/manifest.js +24 -2
- package/lib/platform.js +8 -1
- package/lib/source-map.js +7 -6
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -58,8 +58,9 @@ const {
|
|
|
58
58
|
nvueCssPreprocessOptions,
|
|
59
59
|
nvueHtmlPreprocessOptions,
|
|
60
60
|
getPlatformGlobal,
|
|
61
|
-
getPlatformStat,
|
|
62
|
-
getPlatformPush
|
|
61
|
+
getPlatformStat,
|
|
62
|
+
getPlatformPush,
|
|
63
|
+
getPlatformUniCloud
|
|
63
64
|
} = require('./platform')
|
|
64
65
|
|
|
65
66
|
module.exports = {
|
|
@@ -109,6 +110,7 @@ module.exports = {
|
|
|
109
110
|
nvueCssPreprocessOptions,
|
|
110
111
|
nvueHtmlPreprocessOptions,
|
|
111
112
|
getPlatformGlobal,
|
|
112
|
-
getPlatformStat,
|
|
113
|
-
getPlatformPush
|
|
114
|
-
|
|
113
|
+
getPlatformStat,
|
|
114
|
+
getPlatformPush,
|
|
115
|
+
getPlatformUniCloud
|
|
116
|
+
}
|
package/lib/manifest.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
+
const {
|
|
3
|
+
hasOwn
|
|
4
|
+
} = require('./util')
|
|
2
5
|
|
|
3
6
|
const {
|
|
4
7
|
getJson,
|
|
@@ -98,6 +101,24 @@ function getH5Options (manifestJson) {
|
|
|
98
101
|
return h5
|
|
99
102
|
}
|
|
100
103
|
|
|
104
|
+
function isEnableUniPushV1 (manifestJson, platform) {
|
|
105
|
+
if (!manifestJson) {
|
|
106
|
+
manifestJson = getManifestJson()
|
|
107
|
+
}
|
|
108
|
+
if (isEnableUniPushV2(manifestJson, platform)) {
|
|
109
|
+
return false
|
|
110
|
+
}
|
|
111
|
+
if (platform === 'app-plus') {
|
|
112
|
+
const platformOptions = manifestJson[platform]
|
|
113
|
+
const sdkConfigs = platformOptions && platformOptions.distribute && platformOptions.distribute.sdkConfigs
|
|
114
|
+
const push = sdkConfigs && sdkConfigs.push
|
|
115
|
+
if (push && hasOwn(push, 'unipush')) {
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false
|
|
120
|
+
}
|
|
121
|
+
|
|
101
122
|
function isEnableUniPushV2 (manifestJson, platform) {
|
|
102
123
|
if (!manifestJson) {
|
|
103
124
|
manifestJson = getManifestJson()
|
|
@@ -121,14 +142,15 @@ function isUniPushOffline (manifestJson) {
|
|
|
121
142
|
const platformOptions = manifestJson['app-plus']
|
|
122
143
|
const sdkConfigs = platformOptions && platformOptions.distribute && platformOptions.distribute.sdkConfigs
|
|
123
144
|
const unipush = sdkConfigs && sdkConfigs.push && sdkConfigs.push.unipush
|
|
124
|
-
return unipush && unipush.offline === true
|
|
145
|
+
return unipush && unipush.offline === true
|
|
125
146
|
}
|
|
126
147
|
|
|
127
148
|
module.exports = {
|
|
128
149
|
getManifestJson,
|
|
129
150
|
parseManifestJson,
|
|
130
151
|
getNetworkTimeout,
|
|
131
|
-
getH5Options,
|
|
152
|
+
getH5Options,
|
|
153
|
+
isEnableUniPushV1,
|
|
132
154
|
isEnableUniPushV2,
|
|
133
155
|
isUniPushOffline
|
|
134
156
|
}
|
package/lib/platform.js
CHANGED
|
@@ -168,13 +168,20 @@ module.exports = {
|
|
|
168
168
|
: 'import \'@dcloudio/uni-stat/dist/uni-stat.es.js\';'
|
|
169
169
|
},
|
|
170
170
|
getPlatformPush () {
|
|
171
|
-
if (process.env.UNI_PUSH_V2_OFFLINE) {
|
|
171
|
+
if (process.env.UNI_PUSH_V2_OFFLINE || process.env.UNI_PUSH_V1) {
|
|
172
172
|
return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.plus.es.js\';'
|
|
173
173
|
} else if (process.env.UNI_PUSH_V2) {
|
|
174
174
|
return ';import \'@dcloudio/vue-cli-plugin-uni/packages/uni-push/dist/uni-push.es.js\';'
|
|
175
175
|
}
|
|
176
176
|
return ''
|
|
177
177
|
},
|
|
178
|
+
getPlatformUniCloud () {
|
|
179
|
+
if (JSON.parse(process.env.UNI_CLOUD_PROVIDER || '[]').length) {
|
|
180
|
+
const uniCloudLibPath = '@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js'
|
|
181
|
+
return `import '${uniCloudLibPath}';`
|
|
182
|
+
}
|
|
183
|
+
return ''
|
|
184
|
+
},
|
|
178
185
|
getBabelParserOptions () {
|
|
179
186
|
return {
|
|
180
187
|
sourceType: 'module',
|
package/lib/source-map.js
CHANGED
|
@@ -28,11 +28,11 @@ function getSourceRoot () {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function moduleFilenameTemplate (info) {
|
|
31
|
-
if (
|
|
31
|
+
if (
|
|
32
32
|
info.resourcePath &&
|
|
33
33
|
(
|
|
34
34
|
!info.allLoaders ||
|
|
35
|
-
info.query.includes('type=script&lang=ts') ||
|
|
35
|
+
info.query.includes('type=script&lang=ts') ||
|
|
36
36
|
info.resourcePath.endsWith('.ts')
|
|
37
37
|
)
|
|
38
38
|
) {
|
|
@@ -46,14 +46,15 @@ function moduleFilenameTemplate (info) {
|
|
|
46
46
|
const exclude = [/pages\.json/, /node_modules/, /vue&type=template/, /vue&type=style/]
|
|
47
47
|
|
|
48
48
|
module.exports = {
|
|
49
|
-
createSourceMapDevToolPlugin (filename = false) {
|
|
49
|
+
createSourceMapDevToolPlugin (filename = false, args) {
|
|
50
50
|
const options = {
|
|
51
51
|
test: [/\.js$/],
|
|
52
52
|
exclude,
|
|
53
|
-
moduleFilenameTemplate
|
|
53
|
+
moduleFilenameTemplate,
|
|
54
|
+
...args
|
|
54
55
|
}
|
|
55
56
|
if (filename) {
|
|
56
|
-
options.filename = '../.sourcemap/' + process.env.UNI_PLATFORM + '/[
|
|
57
|
+
options.filename = '../.sourcemap/' + process.env.UNI_PLATFORM + '/[file].map'
|
|
57
58
|
}
|
|
58
59
|
return new webpack.SourceMapDevToolPlugin(options)
|
|
59
60
|
},
|
|
@@ -64,4 +65,4 @@ module.exports = {
|
|
|
64
65
|
moduleFilenameTemplate
|
|
65
66
|
})
|
|
66
67
|
}
|
|
67
|
-
}
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.1-
|
|
3
|
+
"version": "2.0.1-35320220729002",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"postcss-urlrewrite": "^0.2.2",
|
|
24
24
|
"strip-json-comments": "^2.0.1"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "99c489d7a19425ade612162abd21b441260e7ba7"
|
|
27
27
|
}
|