@dcloudio/uni-cli-shared 2.0.2-4020420240722003 → 2.0.2-4020820240925002

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/platform.js CHANGED
@@ -1,5 +1,8 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
+ const {
4
+ getManifestJson
5
+ } = require('./manifest')
3
6
 
4
7
  const {
5
8
  isInHBuilderX,
@@ -17,10 +20,12 @@ function getShadowCss () {
17
20
  if (process.env.UNI_PLATFORM === 'h5') {
18
21
  tagName = 'body'
19
22
  }
20
- const cdn = getShadowCdn()
21
- return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}@keyframes shadow-preload{0%{background-image:url(${cdn}/img/shadow-grey.png)}100%{background-image:url(${cdn}/img/shadow-grey.png)}}`
23
+ const url = createShadowImageUrl(getShadowCdn(), 'grey')
24
+ return `${tagName}::after{position:fixed;content:'';left:-1000px;top:-1000px;-webkit-animation:shadow-preload .1s;-webkit-animation-delay:3s;animation:shadow-preload .1s;animation-delay:3s}@-webkit-keyframes shadow-preload{0%{background-image:url(${url})}100%{background-image:url(${url})}}@keyframes shadow-preload{0%{background-image:url(${url})}100%{background-image:url(${url})}}`
22
25
  }
23
26
  const cdns = {
27
+ h5: '',
28
+ web: '',
24
29
  'mp-weixin': 1,
25
30
  'mp-alipay': 2,
26
31
  'mp-baidu': 3,
@@ -37,8 +42,31 @@ const cdns = {
37
42
  }
38
43
 
39
44
  function getShadowCdn () {
40
- const index = cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
41
- return `https://cdn${index}.dcloud.net.cn`
45
+ return cdns[process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM] || ''
46
+ }
47
+
48
+ let appid
49
+
50
+ function createIdent () {
51
+ if (process.env.UNI_INPUT_DIR) {
52
+ if (typeof appid === 'undefined') {
53
+ appid = getManifestJson().appid || ''
54
+ }
55
+ const id = appid.replace('__UNI__', '')
56
+ if (id) {
57
+ return Buffer.from(Buffer.from(id).toString('base64')).toString('hex')
58
+ }
59
+ }
60
+ return ''
61
+ }
62
+
63
+ function createShadowImageUrl (cdn, type = 'grey') {
64
+ let identStr = ''
65
+ if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'web') {
66
+ const ident = createIdent()
67
+ identStr = ident ? `${ident}/` : ''
68
+ }
69
+ return `https://cdn${cdn || ''}.dcloud.net.cn/${identStr}img/shadow-${type}.png`
42
70
  }
43
71
 
44
72
  // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在
@@ -145,6 +173,7 @@ module.exports = {
145
173
  discardDuplicates: false // 条件编译会导致重复
146
174
  }
147
175
  },
176
+ createShadowImageUrl,
148
177
  getShadowCss,
149
178
  getShadowTemplate (colorType = 'grey') {
150
179
  let tagName = 'cover-image'
@@ -152,7 +181,7 @@ module.exports = {
152
181
  .UNI_PLATFORM === 'mp-xhs') {
153
182
  tagName = 'image'
154
183
  }
155
- return `<${tagName} src="${getShadowCdn()}/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
184
+ return `<${tagName} src="${createShadowImageUrl(getShadowCdn(), colorType)}" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
156
185
  },
157
186
  getPlatformScss () {
158
187
  return SCSS
package/license.md ADDED
@@ -0,0 +1 @@
1
+ [https://uniapp.dcloud.net.cn/license.html ](https://uniapp.dcloud.net.cn/license.html )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.2-4020420240722003",
3
+ "version": "2.0.2-4020820240925002",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "postcss-urlrewrite": "^0.2.2",
27
27
  "strip-json-comments": "^2.0.1"
28
28
  },
29
- "gitHead": "7ab031552c02be8bb0c163fd2b81e6d811b23d29"
29
+ "gitHead": "2f172a32971238da33d2228bd14f0ab3e7699d09"
30
30
  }