@mpxjs/webpack-plugin 2.8.34 → 2.8.36

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/index.js CHANGED
@@ -432,9 +432,9 @@ class MpxWebpackPlugin {
432
432
  mpx.staticResourcesMap[packageRoot] = mpx.staticResourcesMap[packageRoot] || {}
433
433
  mpx.subpackageModulesMap[packageRoot] = mpx.subpackageModulesMap[packageRoot] || {}
434
434
  async.each(deps, (dep, callback) => {
435
- dep.addEntry(compilation, (err, { resultPath }) => {
435
+ dep.addEntry(compilation, (err, result) => {
436
436
  if (err) return callback(err)
437
- dep.resultPath = mpx.replacePathMap[dep.key] = resultPath
437
+ dep.resultPath = mpx.replacePathMap[dep.key] = result.resultPath
438
438
  callback()
439
439
  })
440
440
  }, callback)
@@ -453,7 +453,8 @@ class MpxWebpackPlugin {
453
453
  name: 'MpxWebpackPlugin',
454
454
  stage: -1000
455
455
  }, (compilation, callback) => {
456
- processSubpackagesEntriesMap(compilation, () => {
456
+ processSubpackagesEntriesMap(compilation, (err) => {
457
+ if (err) return callback(err)
457
458
  const checkRegisterPack = () => {
458
459
  for (const packRoot in mpx.dynamicEntryInfo) {
459
460
  const entryMap = mpx.dynamicEntryInfo[packRoot]
@@ -102,7 +102,7 @@ module.exports = function ({ print }) {
102
102
  if (isMustache(value)) {
103
103
  ttValueLog({ name, value })
104
104
  } else {
105
- const supportList = ['share', 'getPhoneNumber', 'contact']
105
+ const supportList = ['share', 'getPhoneNumber', 'contact', 'im', 'openSetting']
106
106
  if (value && supportList.indexOf(value) === -1) {
107
107
  ttValueLogError({ name, value })
108
108
  }
@@ -1,5 +1,7 @@
1
1
  import { isEmptyObject } from '../../utils'
2
- const isTouchDevice = document && ('ontouchstart' in document.documentElement)
2
+ import { isBrowser } from '../../env'
3
+
4
+ const isTouchDevice = isBrowser ? document && ('ontouchstart' in document.documentElement) : true
3
5
 
4
6
  function processModel (listeners, context) {
5
7
  // 该函数只有wx:model的情况下才调用,而且默认e.detail.value有值
@@ -34,27 +34,32 @@
34
34
  }
35
35
  },
36
36
  render (createElement) {
37
- let text = ''
38
37
  let classNames = ['mpx-text']
39
38
  let decode = false
40
39
  const slots = this.$slots.default || []
40
+ const newSlots = []
41
41
  slots.forEach((item) => {
42
42
  if (item.text) {
43
- // item.text = encodeText(item.text)
44
- text += item.text
43
+ switch (this.space) {
44
+ case 'ensp':
45
+ case 'emsp':
46
+ case 'nbsp':
47
+ decode = true
48
+ item.text = item.text.replace(/ /g, `&${this.space};`)
49
+ break
50
+ }
51
+ newSlots.push(createElement('span', {
52
+ domProps: {
53
+ innerHTML: item.text
54
+ }
55
+ }))
56
+ } else {
57
+ newSlots.push(item)
45
58
  }
46
59
  })
47
60
  if (this.selectable) {
48
61
  classNames.push('selectable')
49
62
  }
50
- switch (this.space) {
51
- case 'ensp':
52
- case 'emsp':
53
- case 'nbsp':
54
- decode = true
55
- text = text.replace(/ /g, `&${this.space};`)
56
- break
57
- }
58
63
  if (this.decode) {
59
64
  decode = true
60
65
  }
@@ -62,12 +67,7 @@
62
67
  class: classNames,
63
68
  on: getInnerListeners(this)
64
69
  }
65
- if (decode) {
66
- data.domProps = {
67
- innerHTML: text
68
- }
69
- }
70
- return createElement('span', data, slots)
70
+ return createElement('span', data, decode ? newSlots : slots)
71
71
  }
72
72
  }
73
73
  </script>
@@ -30,7 +30,7 @@ module.exports = function (css, map) {
30
30
 
31
31
  const inlineConfig = Object.assign({}, mpx.postcssInlineConfig, { defs })
32
32
  loadPostcssConfig(this, inlineConfig).then(config => {
33
- const plugins = config.plugins.concat(trim)
33
+ const plugins = [trim] // init with trim plugin
34
34
  const options = Object.assign(
35
35
  {
36
36
  to: this.resourcePath,
@@ -79,6 +79,8 @@ module.exports = function (css, map) {
79
79
  }
80
80
  }
81
81
 
82
+ plugins.push(...config.plugins) // push user config plugins
83
+
82
84
  return postcss(plugins)
83
85
  .process(css, options)
84
86
  .then(result => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.8.34",
3
+ "version": "2.8.36",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -82,5 +82,5 @@
82
82
  "engines": {
83
83
  "node": ">=14.14.0"
84
84
  },
85
- "gitHead": "7943c0a8c559299c4d59a2b27ee4abc543c58f13"
85
+ "gitHead": "f7d1fc9bf1aaf7aff6fe9f2a11288dc5e12f78d6"
86
86
  }