@mpxjs/webpack-plugin 2.6.114-alpha.3 → 2.6.114-alpha.6

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
@@ -1125,11 +1125,13 @@ try {
1125
1125
  if (data.loaders) {
1126
1126
  const { queryObj } = parseRequest(data.request)
1127
1127
  const mpxStyleOptions = queryObj.mpxStyleOptions
1128
+ // todo 本套逻辑可能需要根据mode来提前判断以做编译优化
1128
1129
  const firstLoader = (data.loaders[0] && data.loaders[0].loader) || ''
1129
- const isPitcherRequest = firstLoader.includes('vue-loader/lib/loaders/pitcher.js')
1130
+ const isPitcherRequest = firstLoader.includes('vue-loader/lib/loaders/pitcher.js') || firstLoader.includes('@hummer/tenon-loader/dist/pitcher.js')
1130
1131
  let cssLoaderIndex = -1
1131
1132
  let vueStyleLoaderIndex = -1
1132
1133
  let mpxStyleLoaderIndex = -1
1134
+ let tenonStyleLoaderIndex = -1
1133
1135
  data.loaders.forEach((loader, index) => {
1134
1136
  const currentLoader = loader.loader
1135
1137
  if (currentLoader.includes('ts-loader')) {
@@ -1140,11 +1142,20 @@ try {
1140
1142
  cssLoaderIndex = index
1141
1143
  } else if (currentLoader.includes('vue-loader/lib/loaders/stylePostLoader.js')) {
1142
1144
  vueStyleLoaderIndex = index
1145
+ } else if (currentLoader.includes('@hummer/tenon-style-loader/dist/index.js')) {
1146
+ tenonStyleLoaderIndex = index
1143
1147
  } else if (currentLoader.includes('@mpxjs/webpack-plugin/lib/style-compiler/index.js')) {
1144
1148
  mpxStyleLoaderIndex = index
1145
1149
  }
1146
1150
  })
1147
- if (mpxStyleLoaderIndex === -1) {
1151
+ if (mpx.mode === 'tenon' && mpxStyleLoaderIndex === -1) {
1152
+ if (tenonStyleLoaderIndex > -1 && !isPitcherRequest) {
1153
+ data.loaders.splice(tenonStyleLoaderIndex + 1, 0, {
1154
+ loader: normalize.lib('style-compiler/index.js'),
1155
+ options: (mpxStyleOptions && JSON.parse(mpxStyleOptions)) || {}
1156
+ })
1157
+ }
1158
+ } else if (mpxStyleLoaderIndex === -1) {
1148
1159
  let loaderIndex = -1
1149
1160
  if (cssLoaderIndex > -1 && vueStyleLoaderIndex === -1) {
1150
1161
  loaderIndex = cssLoaderIndex
@@ -150,7 +150,7 @@ export default (function(){
150
150
 
151
151
 
152
152
 
153
- <style lang="stylus">
153
+ <style lang="stylus" scoped>
154
154
  .mpx-button-versionv2
155
155
  width: 184px
156
156
  line-height 1.41176471
@@ -53,7 +53,7 @@ export default {
53
53
  },
54
54
  };
55
55
  </script>
56
- <style lang="stylus">
56
+ <style lang="stylus" scoped>
57
57
  .mpx-image
58
58
  width 300px
59
59
  height 225px
@@ -83,7 +83,7 @@ export default {
83
83
  methods: {},
84
84
  };
85
85
  </script>
86
- <style lang="stylus">
86
+ <style lang="stylus" scoped>
87
87
  .mpx-input
88
88
  cursor auto
89
89
  width 100%
@@ -80,7 +80,7 @@ export default {
80
80
  };
81
81
  </script>
82
82
 
83
- <style lang="stylus">
83
+ <style lang="stylus" scoped>
84
84
  .mpx-switch-wrap
85
85
  .mpx-switch-label
86
86
  border-radius 16hm
@@ -51,7 +51,7 @@ export default {
51
51
  methods: {},
52
52
  };
53
53
  </script>
54
- <style lang="stylus">
54
+ <style lang="stylus" scoped>
55
55
  .mpx-textarea
56
56
  font inherit
57
57
  cursor auto
@@ -55,7 +55,7 @@ export default {
55
55
  },
56
56
  };
57
57
  </script>
58
- <style lang="stylus">
58
+ <style lang="stylus" scoped>
59
59
  .mpx-text
60
60
  user-select none
61
61
  &.selectable
@@ -29,7 +29,7 @@ module.exports = function (css, map) {
29
29
 
30
30
  const transRpxRules = transRpxRulesRaw ? (Array.isArray(transRpxRulesRaw) ? transRpxRulesRaw : [transRpxRulesRaw]) : []
31
31
 
32
- const transRpxFn = mpx.webConfig.transRpxFn
32
+ const transRpxFn = mpx.webConfig && mpx.webConfig.transRpxFn
33
33
  const testResolveRange = (include = () => true, exclude) => {
34
34
  return matchCondition(this.resourcePath, { include, exclude })
35
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/webpack-plugin",
3
- "version": "2.6.114-alpha.3",
3
+ "version": "2.6.114-alpha.6",
4
4
  "description": "mpx compile core",
5
5
  "keywords": [
6
6
  "mpx"
@@ -85,5 +85,5 @@
85
85
  "@types/babel-types": "^7.0.4",
86
86
  "webpack": "^4.46.0"
87
87
  },
88
- "gitHead": "951dd877934ec6233bfb67452b790dc982317ccd"
88
+ "gitHead": "0009455df1bf8dfa2fa63cb7b2d044056337dd4a"
89
89
  }