@dcloudio/uni-cli-shared 2.0.0-32920210927002 → 2.0.0-32920211120001

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.
@@ -34,6 +34,7 @@ const loadMode = {
34
34
  const attrs = [
35
35
  'pageCurrent',
36
36
  'pageSize',
37
+ 'spaceInfo',
37
38
  'collection',
38
39
  'action',
39
40
  'field',
@@ -54,6 +55,12 @@ export default {
54
55
  return {}
55
56
  }
56
57
  },
58
+ spaceInfo: {
59
+ type: Object,
60
+ default () {
61
+ return {}
62
+ }
63
+ },
57
64
  collection: {
58
65
  type: [String, Array],
59
66
  default: ''
@@ -178,12 +185,14 @@ export default {
178
185
  })
179
186
  return al
180
187
  }, (newValue, oldValue) => {
188
+ this.paginationInternal.size = this.pageSize
189
+ if (newValue[0] !== oldValue[0]) {
190
+ this.paginationInternal.current = this.pageCurrent
191
+ }
181
192
  if (this.loadtime === loadMode.manual) {
182
193
  return
183
194
  }
184
195
 
185
- this.paginationInternal.size = this.pageSize
186
-
187
196
  let needReset = false
188
197
  for (let i = 2; i < newValue.length; i++) {
189
198
  if (newValue[i] !== oldValue[i]) {
@@ -195,9 +204,6 @@ export default {
195
204
  this.clear()
196
205
  this.reset()
197
206
  }
198
- if (newValue[0] !== oldValue[0]) {
199
- this.paginationInternal.current = this.pageCurrent
200
- }
201
207
 
202
208
  this._execLoadData()
203
209
  })
@@ -324,7 +330,7 @@ export default {
324
330
  })
325
331
  }
326
332
  /* eslint-disable no-undef */
327
- let db = uniCloud.database()
333
+ let db = uniCloud.database(this.spaceInfo)
328
334
  if (action) {
329
335
  db = db.action(action)
330
336
  }
@@ -398,7 +404,7 @@ export default {
398
404
  })
399
405
  }
400
406
  /* eslint-disable no-undef */
401
- let db = uniCloud.database()
407
+ let db = uniCloud.database(this.spaceInfo)
402
408
  if (action) {
403
409
  db = db.action(action)
404
410
  }
@@ -427,7 +433,7 @@ export default {
427
433
  },
428
434
  getTemp (isTemp = true) {
429
435
  /* eslint-disable no-undef */
430
- let db = uniCloud.database()
436
+ let db = uniCloud.database(this.spaceInfo)
431
437
 
432
438
  if (this.action) {
433
439
  db = db.action(this.action)
@@ -576,7 +582,7 @@ export default {
576
582
  }
577
583
 
578
584
  /* eslint-disable no-undef */
579
- const db = uniCloud.database()
585
+ const db = uniCloud.database(this.spaceInfo)
580
586
  const dbCmd = db.command
581
587
 
582
588
  let exec = db
package/lib/manifest.js CHANGED
@@ -85,8 +85,7 @@ function getH5Options (manifestJson) {
85
85
  }
86
86
 
87
87
  /* eslint-disable no-mixed-operators */
88
- h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(__dirname,
89
- '../../../../public/index.html')
88
+ h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(require('./util').getCLIContext(), 'public/index.html')
90
89
 
91
90
  h5.devServer = h5.devServer || {}
92
91
 
@@ -103,4 +102,4 @@ module.exports = {
103
102
  parseManifestJson,
104
103
  getNetworkTimeout,
105
104
  getH5Options
106
- }
105
+ }
package/lib/platform.js CHANGED
@@ -122,7 +122,7 @@ module.exports = {
122
122
  getShadowCss,
123
123
  getShadowTemplate (colorType = 'grey') {
124
124
  let tagName = 'cover-image'
125
- if (process.env.UNI_PLATFORM === 'mp-toutiao') {
125
+ if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
126
126
  tagName = 'image'
127
127
  }
128
128
  return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
@@ -137,6 +137,8 @@ module.exports = {
137
137
  return {
138
138
  sourceType: 'module',
139
139
  plugins: [
140
+ ['pipelineOperator', { proposal: 'minimal' }],
141
+ 'doExpressions',
140
142
  'optionalChaining',
141
143
  'typescript',
142
144
  ['decorators', {
package/lib/url-loader.js CHANGED
@@ -10,6 +10,7 @@ const inlineLimit =
10
10
  process.env.UNI_PLATFORM === 'mp-qq' ||
11
11
  process.env.UNI_PLATFORM === 'mp-toutiao' ||
12
12
  process.env.UNI_PLATFORM === 'mp-kuaishou' ||
13
+ process.env.UNI_PLATFORM === 'mp-lark' ||
13
14
  process.env.UNI_PLATFORM === 'app-plus' // v2需要base64,v3需要rewriteUrl
14
15
 
15
16
  // mp-weixin,mp-qq,app-plus 非v3(即:需要base64的平台)
@@ -46,4 +47,4 @@ module.exports = {
46
47
  }
47
48
  },
48
49
  rewriteUrl
49
- }
50
+ }
package/lib/util.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path')
2
+ const fs = require('fs')
2
3
  const hash = require('hash-sum')
3
4
  const crypto = require('crypto')
4
5
 
@@ -14,6 +15,24 @@ try {
14
15
  const isInHBuilderX = !!aboutPkg
15
16
  const isInHBuilderXAlpha = !!(isInHBuilderX && aboutPkg.alpha)
16
17
 
18
+ function getCLIContext () {
19
+ var context = path.resolve(__dirname, '../../../../')
20
+ // const isInHBuilderX = fs.existsSync(path.resolve(context, 'bin/uniapp-cli.js'))
21
+ if (isInHBuilderX) {
22
+ return context
23
+ }
24
+ const pnpmFind = __dirname.match(/.+?[/\\].pnpm[/\\]/)
25
+ if (pnpmFind) {
26
+ const pnpm = pnpmFind[0]
27
+ context = path.resolve(pnpm, '../../')
28
+ }
29
+ const isInCLI = fs.existsSync(path.resolve(context, './src'))
30
+ if (isInCLI) {
31
+ return context
32
+ }
33
+ return process.cwd()
34
+ }
35
+
17
36
  function removeExt (str, ext) {
18
37
  if (ext) {
19
38
  const reg = new RegExp(ext.replace(/\./, '\\.') + '$')
@@ -105,6 +124,7 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty
105
124
  module.exports = {
106
125
  isInHBuilderX,
107
126
  isInHBuilderXAlpha,
127
+ getCLIContext,
108
128
  normalizeNodeModules,
109
129
  md5,
110
130
  hasOwn (obj, key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.0-32920210927002",
3
+ "version": "2.0.0-32920211120001",
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": "26392aaabf15a32cc592756b691a11ac312b0ac6"
26
+ "gitHead": "32ebf532a67f1f2c2abe2ed6e22a94599ffbb5a0"
27
27
  }