@dcloudio/vue-cli-plugin-hbuilderx 2.0.1-34620220419001 → 2.0.1-34920220607001

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.
@@ -86,7 +86,9 @@ const plugins = [
86
86
  UNI_CLOUD_PROVIDER: process.env.UNI_CLOUD_PROVIDER,
87
87
  UNICLOUD_DEBUG: process.env.UNICLOUD_DEBUG,
88
88
  RUN_BY_HBUILDERX: process.env.RUN_BY_HBUILDERX,
89
- UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT)
89
+ UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT),
90
+ UNI_STAT_UNI_CLOUD: process.env.UNI_STAT_UNI_CLOUD || '',
91
+ UNI_STAT_DEBUG: process.env.UNI_STAT_DEBUG || ''
90
92
  }
91
93
  }),
92
94
  new webpack.BannerPlugin({
@@ -209,9 +211,11 @@ if (process.env.UNI_USING_V3_NATIVE) {
209
211
 
210
212
  if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
211
213
  plugins.push(new WebpackUniMPPlugin())
214
+ const assetsDir = 'static'
215
+ const hybridDir = 'hybrid/html'
212
216
  const array = [{
213
- from: path.resolve(process.env.UNI_INPUT_DIR, 'static'),
214
- to: 'static'
217
+ from: path.resolve(process.env.UNI_INPUT_DIR, assetsDir),
218
+ to: assetsDir
215
219
  }]
216
220
  // 自动化测试时,不启用androidPrivacy.json
217
221
  if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
@@ -223,14 +227,34 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
223
227
  })
224
228
  }
225
229
  }
226
- const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, 'hybrid/html')
230
+ const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridDir)
227
231
  if (fs.existsSync(hybridHtmlPath)) {
228
232
  array.push({
229
233
  from: hybridHtmlPath,
230
- to: 'hybrid/html'
234
+ to: hybridDir
231
235
  })
232
236
  }
233
237
 
238
+ global.uniModules.forEach(module => {
239
+ const modules = 'uni_modules/'
240
+ const assets = modules + module + '/' + assetsDir
241
+ const assetsPath = path.resolve(process.env.UNI_INPUT_DIR, assets)
242
+ if (fs.existsSync(assetsPath)) {
243
+ array.push({
244
+ from: assetsPath,
245
+ to: assets
246
+ })
247
+ }
248
+ const hybridHtml = modules + module + '/' + hybridDir
249
+ const hybridHtmlPath = path.resolve(process.env.UNI_INPUT_DIR, hybridHtml)
250
+ if (fs.existsSync(hybridHtmlPath)) {
251
+ array.push({
252
+ from: hybridHtmlPath,
253
+ to: hybridHtml
254
+ })
255
+ }
256
+ })
257
+
234
258
  if (process.env.UNI_USING_NVUE_COMPILER) {
235
259
  array.push({
236
260
  from: path.resolve(getTemplatePath(), 'common'),
@@ -316,6 +340,7 @@ module.exports = function () {
316
340
  extensions: ['.js', '.nvue', '.vue', '.json'],
317
341
  alias: {
318
342
  '@': process.env.UNI_INPUT_DIR,
343
+ 'uni-polyfill': require.resolve('@dcloudio/uni-cli-shared/lib/uni-polyfill.js'),
319
344
  'uni-pages': path.resolve(process.env.UNI_INPUT_DIR, 'pages.json'),
320
345
  'uni-app-style': path.resolve(process.env.UNI_INPUT_DIR, getNVueMainEntry()) + '?' + JSON.stringify({
321
346
  type: 'appStyle'
@@ -389,4 +414,4 @@ module.exports = function () {
389
414
  zlib: false
390
415
  }
391
416
  }
392
- }
417
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-hbuilderx",
3
- "version": "2.0.1-34620220419001",
3
+ "version": "2.0.1-34920220607001",
4
4
  "description": "HBuilderX plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -18,5 +18,5 @@
18
18
  "css": "~2.2.1",
19
19
  "escodegen": "^1.8.1"
20
20
  },
21
- "gitHead": "854e276491925f39e0a6145ccca2828e00f242c0"
21
+ "gitHead": "d9ada15e81acf4b4b30926174fb4abb028a462ec"
22
22
  }
@@ -59,22 +59,8 @@ module.exports = function (content, map) {
59
59
  return `
60
60
  ${statCode}
61
61
  import 'uni-app-style'
62
+ import 'uni-polyfill'
62
63
  import App from './${normalizePath(params.page)}.nvue?mpType=page'
63
- if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
64
- Promise.prototype.finally = function(callback) {
65
- var promise = this.constructor
66
- return this.then(function(value) {
67
- return promise.resolve(callback()).then(function() {
68
- return value
69
- })
70
- }, function(reason) {
71
- return promise.resolve(callback()).then(function() {
72
- throw reason
73
- })
74
- })
75
- }
76
- }
77
- ArrayBuffer = uni.base64ToArrayBuffer('').constructor
78
64
  App.mpType = 'page'
79
65
  App.route = '${params.page}'
80
66
  App.el = '#root'
@@ -8,7 +8,6 @@ module.exports = function (content, map) {
8
8
  this.callback(null, 'module.exports = ' + genStyleString(content, this), map)
9
9
  }
10
10
  const uniI18n = require('@dcloudio/uni-cli-i18n')
11
- const print = require('../../../util/console')
12
11
 
13
12
  // @todo:
14
13
  // font-relative lengths: em, ex, ch, ic
@@ -60,13 +59,13 @@ function genStyleString (input, loader) {
60
59
  msgs.forEach(msg => {
61
60
  switch (msg.split(':')[0]) {
62
61
  case 'ERROR':
63
- print.error(msg)
62
+ console.error(msg)
64
63
  break
65
64
  case 'WARNING' :
66
- print.warn(msg)
65
+ console.warn(msg)
67
66
  break
68
67
  default:
69
- print.log(msg)
68
+ console.log(msg)
70
69
  break
71
70
  }
72
71
  })
@@ -16,15 +16,34 @@ function clearImportant (value) {
16
16
  }
17
17
 
18
18
  function transition (declaration) {
19
- var CHUNK_REGEXP = /^(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?\s*(\S*)?\s*(\d*\.?\d+(?:ms|s)?)?$/
19
+ var CHUNK_REGEXP = /^([a-z-_]\S*)(\s+[\d.]+m?s)?(\s+[a-z-_]\S*)?(\s+[\d.]+m?s)?/
20
20
  var { value, important } = clearImportant(declaration.value)
21
- var match = value.match(CHUNK_REGEXP)
22
- var result = []
21
+ var values = value.replace(/(\d)\s*,\s*/g, '$1#').split(',')
23
22
  var position = declaration.position
24
- match[1] && result.push(generateDeclaration('transition-property', match[1], important, position))
25
- match[2] && result.push(generateDeclaration('transition-duration', match[2], important, position))
26
- match[3] && result.push(generateDeclaration('transition-timing-function', match[3], important, position))
27
- match[4] && result.push(generateDeclaration('transition-delay', match[4], important, position))
23
+ var result = []
24
+ var map = {
25
+ 'transition-property': [],
26
+ 'transition-duration': [],
27
+ 'transition-timing-function': [],
28
+ 'transition-delay': []
29
+ }
30
+ if (values.length) {
31
+ for (var i1 = 0; i1 < values.length; i1++) {
32
+ var match = values[i1].trim().match(CHUNK_REGEXP)
33
+ if (!match) {
34
+ return []
35
+ }
36
+ map['transition-property'].push(match[1] || 'all')
37
+ map['transition-duration'].push((match[2] || '0s').trim())
38
+ map['transition-timing-function'].push((match[3] || 'ease').trim().replace(/#/g, ', '))
39
+ map['transition-delay'].push((match[4] || '0s').trim())
40
+ }
41
+ for (var key in map) {
42
+ var value = map[key]
43
+ value = value.find(item => item !== value[0]) ? value.join(', ') : value[0]
44
+ result.push(generateDeclaration(key, value, important, position))
45
+ }
46
+ }
28
47
  return result
29
48
  }
30
49
 
@@ -43,6 +43,66 @@ describe('shorthand-parser', function () {
43
43
  position: {}
44
44
  }
45
45
  ])
46
+
47
+ expect(shorthandParser([{
48
+ type: 'declaration',
49
+ property: 'transition',
50
+ value: 'width 2s ease-in-out, height 1s 1s, top cubic-bezier(0.1, 0.7, 1.0, 0.1)',
51
+ position: {}
52
+ }])).eql([{
53
+ type: 'declaration',
54
+ property: 'transition-property',
55
+ value: 'width, height, top',
56
+ position: {}
57
+ },
58
+ {
59
+ type: 'declaration',
60
+ property: 'transition-duration',
61
+ value: '2s, 1s, 0s',
62
+ position: {}
63
+ },
64
+ {
65
+ type: 'declaration',
66
+ property: 'transition-timing-function',
67
+ value: 'ease-in-out, ease, cubic-bezier(0.1, 0.7, 1.0, 0.1)',
68
+ position: {}
69
+ },
70
+ {
71
+ type: 'declaration',
72
+ property: 'transition-delay',
73
+ value: '0s, 1s, 0s',
74
+ position: {}
75
+ }])
76
+
77
+ expect(shorthandParser([{
78
+ type: 'declaration',
79
+ property: 'transition',
80
+ value: 'width 2s, height 2s',
81
+ position: {}
82
+ }])).eql([{
83
+ type: 'declaration',
84
+ property: 'transition-property',
85
+ value: 'width, height',
86
+ position: {}
87
+ },
88
+ {
89
+ type: 'declaration',
90
+ property: 'transition-duration',
91
+ value: '2s',
92
+ position: {}
93
+ },
94
+ {
95
+ type: 'declaration',
96
+ property: 'transition-timing-function',
97
+ value: 'ease',
98
+ position: {}
99
+ },
100
+ {
101
+ type: 'declaration',
102
+ property: 'transition-delay',
103
+ value: '0s',
104
+ position: {}
105
+ }])
46
106
  })
47
107
 
48
108
  it('parse margin', function () {
package/util/console.js DELETED
@@ -1,23 +0,0 @@
1
- const ZERO_WIDTH_CHAR = {
2
- NOTE: '',
3
- WARNING: '\u200B',
4
- ERROR: '\u200C',
5
- backup0: '\u200D',
6
- backup1: '\u200E',
7
- backup2: '\u200F',
8
- backup3: '\uFEFF'
9
- }
10
-
11
- module.exports = {
12
- warn (msg) {
13
- msg = ZERO_WIDTH_CHAR.WARNING + msg + ZERO_WIDTH_CHAR.WARNING
14
- console.warn(msg)
15
- },
16
- error (msg) {
17
- msg = ZERO_WIDTH_CHAR.ERROR + msg + ZERO_WIDTH_CHAR.ERROR
18
- console.error(msg)
19
- },
20
- log (msg) {
21
- console.log(msg)
22
- }
23
- }