@dcloudio/uni-cli-shared 2.0.2-3090820231124001 → 2.0.2-3090920231225001

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.
Files changed (2) hide show
  1. package/lib/cache.js +17 -26
  2. package/package.json +2 -2
package/lib/cache.js CHANGED
@@ -79,7 +79,9 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com
79
79
  if (type === 'Component') {
80
80
  jsonObj.component = true
81
81
  if (process.env.UNI_PLATFORM === 'mp-alipay') {
82
- jsonObj.styleIsolation = 'apply-shared'
82
+ const manifestConfig = process.UNI_MANIFEST
83
+ const alipayConfig = manifestConfig['mp-alipay'] || {}
84
+ jsonObj.styleIsolation = alipayConfig.styleIsolation || 'apply-shared'
83
85
  }
84
86
  } else if (type === 'Page') {
85
87
  if (process.env.UNI_PLATFORM === 'mp-baidu') {
@@ -160,39 +162,28 @@ function updateUsingComponents (name, usingComponents, type) {
160
162
  }
161
163
 
162
164
  const oldJsonStr = getJsonFile(name)
163
- if (oldJsonStr) { // update
164
- const jsonObj = JSON.parse(oldJsonStr)
165
- if (type === 'Component') {
165
+ const jsonObj = oldJsonStr ? JSON.parse(oldJsonStr) : {
166
+ usingComponents
167
+ }
168
+ if (type === 'Component') {
169
+ jsonObj.component = true
170
+ if (process.env.UNI_PLATFORM === 'mp-alipay') {
171
+ const manifestConfig = process.UNI_MANIFEST
172
+ const alipayConfig = manifestConfig['mp-alipay'] || {}
173
+ jsonObj.styleIsolation = alipayConfig.styleIsolation || 'apply-shared'
174
+ }
175
+ } else if (type === 'Page') {
176
+ if (process.env.UNI_PLATFORM === 'mp-baidu') {
166
177
  jsonObj.component = true
167
- if (process.env.UNI_PLATFORM === 'mp-alipay') {
168
- jsonObj.styleIsolation = 'apply-shared'
169
- }
170
- } else if (type === 'Page') {
171
- if (process.env.UNI_PLATFORM === 'mp-baidu') {
172
- jsonObj.component = true
173
- }
174
178
  }
175
-
179
+ }
180
+ if (oldJsonStr) { // update
176
181
  jsonObj.usingComponents = usingComponents
177
182
  const newJsonStr = JSON.stringify(jsonObj, null, 2)
178
183
  if (newJsonStr !== oldJsonStr) {
179
184
  updateJsonFile(name, newJsonStr)
180
185
  }
181
186
  } else { // add
182
- const jsonObj = {
183
- usingComponents
184
- }
185
- if (type === 'Component') {
186
- jsonObj.component = true
187
- if (process.env.UNI_PLATFORM === 'mp-alipay') {
188
- jsonObj.styleIsolation = 'apply-shared'
189
- }
190
- } else if (type === 'Page') {
191
- if (process.env.UNI_PLATFORM === 'mp-baidu') {
192
- jsonObj.component = true
193
- }
194
- }
195
-
196
187
  updateJsonFile(name, jsonObj)
197
188
  }
198
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.2-3090820231124001",
3
+ "version": "2.0.2-3090920231225001",
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": "c32691147b539a337d6bca396ba42a6c3ddc1dbf"
29
+ "gitHead": "930c6d04bc26067ed5f7b8a1e782ad43760509fd"
30
30
  }