@dcloudio/uni-cli-shared 2.0.2-3090820231124001 → 2.0.2-4000620240325001
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/components/i18n/en.json +2 -0
- package/components/i18n/es.json +2 -0
- package/components/i18n/fr.json +2 -0
- package/components/i18n/zh-Hans.json +2 -0
- package/components/i18n/zh-Hant.json +2 -0
- package/components/unicloud-db.vue +20 -1
- package/lib/cache.js +17 -26
- package/lib/file-loader.js +26 -7
- package/lib/pages.js +10 -2
- package/lib/url-loader.js +5 -2
- package/package.json +2 -2
package/components/i18n/en.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"uniCloud.component.add.success": "Success",
|
|
3
3
|
"uniCloud.component.update.success": "Success",
|
|
4
|
+
"uniCloud.component.update.showModal.title": "Tips",
|
|
5
|
+
"uniCloud.component.update.showModal.content": "是否更新该数据",
|
|
4
6
|
"uniCloud.component.remove.showModal.title": "Tips",
|
|
5
7
|
"uniCloud.component.remove.showModal.content": "是否删除该数据"
|
|
6
8
|
}
|
package/components/i18n/es.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"uniCloud.component.add.success": "新增成功",
|
|
3
3
|
"uniCloud.component.update.success": "修改成功",
|
|
4
|
+
"uniCloud.component.update.showModal.title": "提示",
|
|
5
|
+
"uniCloud.component.update.showModal.content": "是否更新该数据",
|
|
4
6
|
"uniCloud.component.remove.showModal.title": "提示",
|
|
5
7
|
"uniCloud.component.remove.showModal.content": "是否删除该数据"
|
|
6
8
|
}
|
package/components/i18n/fr.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"uniCloud.component.add.success": "新增成功",
|
|
3
3
|
"uniCloud.component.update.success": "修改成功",
|
|
4
|
+
"uniCloud.component.update.showModal.title": "提示",
|
|
5
|
+
"uniCloud.component.update.showModal.content": "是否更新该数据",
|
|
4
6
|
"uniCloud.component.remove.showModal.title": "提示",
|
|
5
7
|
"uniCloud.component.remove.showModal.content": "是否删除该数据"
|
|
6
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"uniCloud.component.add.success": "新增成功",
|
|
3
3
|
"uniCloud.component.update.success": "修改成功",
|
|
4
|
+
"uniCloud.component.update.showModal.title": "提示",
|
|
5
|
+
"uniCloud.component.update.showModal.content": "是否更新该数据",
|
|
4
6
|
"uniCloud.component.remove.showModal.title": "提示",
|
|
5
7
|
"uniCloud.component.remove.showModal.content": "是否删除该数据"
|
|
6
8
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"uniCloud.component.add.success": "新增成功",
|
|
3
3
|
"uniCloud.component.update.success": "修改成功",
|
|
4
|
+
"uniCloud.component.update.showModal.title": "提示",
|
|
5
|
+
"uniCloud.component.update.showModal.content": "是否更新该数据",
|
|
4
6
|
"uniCloud.component.remove.showModal.title": "提示",
|
|
5
7
|
"uniCloud.component.remove.showModal.content": "是否刪除數據"
|
|
6
8
|
}
|
|
@@ -387,10 +387,29 @@ export default {
|
|
|
387
387
|
success,
|
|
388
388
|
fail,
|
|
389
389
|
complete,
|
|
390
|
+
confirmTitle,
|
|
391
|
+
confirmContent,
|
|
390
392
|
needConfirm = true,
|
|
391
393
|
needLoading = true,
|
|
392
394
|
loadingTitle = ''
|
|
393
395
|
} = {}) {
|
|
396
|
+
if (!needConfirm) {
|
|
397
|
+
this._doUpdate(id, value, action, success, fail, complete, needConfirm, needLoading, loadingTitle)
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
uni.showModal({
|
|
401
|
+
title: confirmTitle || t('uniCloud.component.update.showModal.title'),
|
|
402
|
+
content: confirmContent || t('uniCloud.component.update.showModal.content'),
|
|
403
|
+
showCancel: true,
|
|
404
|
+
success: (res) => {
|
|
405
|
+
if (!res.confirm) {
|
|
406
|
+
return
|
|
407
|
+
}
|
|
408
|
+
this._doUpdate(id, value, action, success, fail, complete, needConfirm, needLoading, loadingTitle)
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
},
|
|
412
|
+
_doUpdate (id, value, action, success, fail, complete, needConfirm, needLoading, loadingTitle) {
|
|
394
413
|
if (needLoading) {
|
|
395
414
|
uni.showLoading({
|
|
396
415
|
title: loadingTitle
|
|
@@ -402,7 +421,7 @@ export default {
|
|
|
402
421
|
db = db.action(action)
|
|
403
422
|
}
|
|
404
423
|
|
|
405
|
-
|
|
424
|
+
db.collection(this.getMainCollection()).doc(id).update(value).then((res) => {
|
|
406
425
|
success && success(res)
|
|
407
426
|
if (showToast) {
|
|
408
427
|
uni.showToast({
|
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
|
-
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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/lib/file-loader.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
+
const webpack = require('webpack')
|
|
2
3
|
const {
|
|
3
|
-
|
|
4
|
+
normalizePath
|
|
5
|
+
// normalizeNodeModules
|
|
4
6
|
} = require('./util')
|
|
5
7
|
|
|
8
|
+
let inputDir
|
|
9
|
+
|
|
6
10
|
module.exports = {
|
|
7
11
|
loader: 'file-loader',
|
|
8
12
|
options: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
name (resourcePath, resourceQuery) {
|
|
14
|
+
if (!inputDir) {
|
|
15
|
+
inputDir = normalizePath(process.env.UNI_INPUT_DIR)
|
|
16
|
+
}
|
|
17
|
+
resourcePath = normalizePath(resourcePath)
|
|
18
|
+
if (resourcePath.startsWith(inputDir)) {
|
|
19
|
+
const relativePath = normalizePath(path.relative(inputDir,
|
|
20
|
+
resourcePath))
|
|
21
|
+
if (relativePath.startsWith('static/') || relativePath.includes(
|
|
22
|
+
'/static/')) {
|
|
23
|
+
return relativePath
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return `assets/[name].[hash:8]${webpack.version[0] > 4 ? '' : '.'}[ext]`
|
|
14
27
|
}
|
|
28
|
+
// publicPath (url, resourcePath, context) {
|
|
29
|
+
// return '/' + normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
|
|
30
|
+
// },
|
|
31
|
+
// outputPath (url, resourcePath, context) {
|
|
32
|
+
// return normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
|
|
33
|
+
// }
|
|
15
34
|
}
|
|
16
|
-
}
|
|
35
|
+
}
|
package/lib/pages.js
CHANGED
|
@@ -122,7 +122,15 @@ function isValidPage (page, root = '') {
|
|
|
122
122
|
let pagePath = page.path
|
|
123
123
|
|
|
124
124
|
if (pagePath.indexOf('platforms') === 0) { // 平台相关
|
|
125
|
-
if (
|
|
125
|
+
if (process.env.UNI_PLATFORM === 'h5' || process.env.UNI_PLATFORM === 'web') {
|
|
126
|
+
if (!(pagePath.indexOf('platforms/h5/') === 0 || pagePath.indexOf('platforms/web/') === 0)) {
|
|
127
|
+
return false
|
|
128
|
+
}
|
|
129
|
+
} else if (process.env.UNI_PLATFORM === 'app-plus' || process.env.UNI_PLATFORM === 'app') {
|
|
130
|
+
if (!(pagePath.indexOf('platforms/app-plus/') === 0 || pagePath.indexOf('platforms/app/') === 0)) {
|
|
131
|
+
return false
|
|
132
|
+
}
|
|
133
|
+
} else if (pagePath.indexOf('platforms/' + process.env.UNI_PLATFORM) === -1) { // 非本平台
|
|
126
134
|
return false
|
|
127
135
|
}
|
|
128
136
|
}
|
|
@@ -578,4 +586,4 @@ module.exports = {
|
|
|
578
586
|
getGlobalUsingComponentsCode,
|
|
579
587
|
parseUsingAutoImportComponents,
|
|
580
588
|
generateGlobalUsingComponentsCode
|
|
581
|
-
}
|
|
589
|
+
}
|
package/lib/url-loader.js
CHANGED
|
@@ -35,8 +35,11 @@ module.exports = {
|
|
|
35
35
|
loader: 'url-loader',
|
|
36
36
|
options () {
|
|
37
37
|
if (process.env.UNI_PLATFORM === 'h5') {
|
|
38
|
-
// h5平台,不对 url-loader 作调整,默认limit:4096,也不修改file-loader
|
|
39
|
-
return {
|
|
38
|
+
// h5平台,不对 url-loader 作调整,默认limit:4096,也不修改file-loader输出路径(已做处理)
|
|
39
|
+
return {
|
|
40
|
+
...defaultOptions,
|
|
41
|
+
limit: 4096
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
if (inlineLimit) {
|
|
42
45
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-4000620240325001",
|
|
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": "
|
|
29
|
+
"gitHead": "2f9ba8ff3e3f185745faa67dd4eefaef7f3db374"
|
|
30
30
|
}
|