@mpxjs/webpack-plugin 2.7.52 → 2.8.0-beta.2

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.
Files changed (71) hide show
  1. package/lib/config.js +24 -24
  2. package/lib/dependencies/CommonJsVariableDependency.js +1 -1
  3. package/lib/dependencies/DynamicEntryDependency.js +18 -11
  4. package/lib/extractor.js +1 -1
  5. package/lib/helpers.js +3 -1
  6. package/lib/index.js +24 -21
  7. package/lib/json-compiler/helper.js +1 -1
  8. package/lib/json-compiler/index.js +17 -17
  9. package/lib/json-compiler/plugin.js +3 -2
  10. package/lib/json-compiler/theme.js +1 -1
  11. package/lib/loader.js +3 -3
  12. package/lib/native-loader.js +1 -1
  13. package/lib/platform/json/normalize-test.js +3 -1
  14. package/lib/platform/run-rules.js +2 -2
  15. package/lib/platform/template/wx/component-config/camera.js +3 -3
  16. package/lib/platform/template/wx/component-config/canvas.js +5 -5
  17. package/lib/platform/template/wx/component-config/map.js +5 -5
  18. package/lib/platform/template/wx/component-config/navigator.js +7 -7
  19. package/lib/platform/template/wx/component-config/progress.js +4 -4
  20. package/lib/platform/template/wx/component-config/scroll-view.js +3 -3
  21. package/lib/platform/template/wx/component-config/slider.js +6 -6
  22. package/lib/platform/template/wx/component-config/swiper.js +2 -2
  23. package/lib/platform/template/wx/component-config/video.js +4 -4
  24. package/lib/platform/template/wx/component-config/view.js +4 -4
  25. package/lib/platform/template/wx/index.js +45 -13
  26. package/lib/resolver/PackageEntryPlugin.js +1 -1
  27. package/lib/runtime/components/web/filterTag.js +6 -6
  28. package/lib/runtime/components/web/getInnerListeners.js +1 -1
  29. package/lib/runtime/components/web/mpx-button.vue +0 -1
  30. package/lib/runtime/components/web/mpx-icon.vue +1 -1
  31. package/lib/runtime/components/web/mpx-keep-alive.vue +2 -2
  32. package/lib/runtime/components/web/mpx-picker.vue +1 -1
  33. package/lib/runtime/components/web/mpx-progress.vue +1 -1
  34. package/lib/runtime/components/web/mpx-scroll-view.vue +1 -1
  35. package/lib/runtime/env.js +1 -0
  36. package/lib/runtime/i18n.wxs +44 -81
  37. package/lib/runtime/optionProcessor.d.ts +0 -4
  38. package/lib/runtime/optionProcessor.js +15 -13
  39. package/lib/runtime/stringify.wxs +3 -3
  40. package/lib/runtime/swanHelper.wxs +2 -2
  41. package/lib/runtime/{components/web/util.js → utils.js} +8 -5
  42. package/lib/script-setup-compiler/index.js +1163 -0
  43. package/lib/style-compiler/index.js +1 -1
  44. package/lib/style-compiler/plugins/rpx.js +1 -1
  45. package/lib/style-compiler/plugins/vw.js +6 -4
  46. package/lib/template-compiler/bind-this.js +5 -5
  47. package/lib/template-compiler/compiler.js +122 -179
  48. package/lib/template-compiler/index.js +3 -3
  49. package/lib/utils/add-query.js +2 -1
  50. package/lib/utils/gen-component-tag.js +1 -1
  51. package/lib/utils/has-own.js +5 -0
  52. package/lib/utils/is-empty-object.js +2 -1
  53. package/lib/utils/parse-request.js +3 -3
  54. package/lib/utils/{index.js → process-defs.js} +3 -10
  55. package/lib/utils/stringify-query.js +23 -21
  56. package/lib/web/processJSON.js +5 -5
  57. package/lib/web/processScript.js +16 -19
  58. package/lib/web/processTemplate.js +1 -1
  59. package/lib/wxml/loader.js +3 -3
  60. package/lib/wxs/i18n-loader.js +4 -11
  61. package/lib/wxs/pre-loader.js +51 -44
  62. package/lib/wxss/compile-exports.js +4 -4
  63. package/lib/wxss/createResolver.js +3 -3
  64. package/lib/wxss/css-base.js +13 -13
  65. package/lib/wxss/getLocalIdent.js +5 -4
  66. package/lib/wxss/loader.js +1 -1
  67. package/lib/wxss/localsLoader.js +14 -14
  68. package/lib/wxss/processCss.js +10 -7
  69. package/package.json +4 -3
  70. package/lib/utils/env.js +0 -4
  71. package/lib/utils/parse-asset.js +0 -195
@@ -51,7 +51,7 @@ module.exports = function (css, map) {
51
51
  defs
52
52
  }))
53
53
 
54
- for (let item of transRpxRules) {
54
+ for (const item of transRpxRules) {
55
55
  const {
56
56
  mode,
57
57
  comment,
@@ -11,7 +11,7 @@ module.exports = (options = {}) => {
11
11
  const designWidth = options.designWidth || 750
12
12
  const ratio = +(baseWidth / designWidth).toFixed(2)
13
13
  function isIgnoreComment (node) {
14
- let result = node && node.type === 'comment' && node.text.trim() === (options.comment || defaultIgnoreComment)
14
+ const result = node && node.type === 'comment' && node.text.trim() === (options.comment || defaultIgnoreComment)
15
15
  if (result) {
16
16
  node.remove()
17
17
  }
@@ -7,10 +7,12 @@ module.exports = (options = {}) => {
7
7
  Once: (root) => {
8
8
  const rpx2vwRatio = +(100 / 750).toFixed(8)
9
9
 
10
- const transRpxFn = options.transRpxFn && typeof options.transRpxFn === 'function' ? options.transRpxFn : function (match, $1) {
11
- if ($1 === '0') return $1
12
- return `${$1 * rpx2vwRatio}vw`
13
- }
10
+ const transRpxFn = options.transRpxFn && typeof options.transRpxFn === 'function'
11
+ ? options.transRpxFn
12
+ : function (match, $1) {
13
+ if ($1 === '0') return $1
14
+ return `${$1 * rpx2vwRatio}vw`
15
+ }
14
16
  function transVw (declaration) {
15
17
  if (rpxRegExp.test(declaration.value)) {
16
18
  declaration.value = declaration.value.replace(rpxRegExpG, transRpxFn)
@@ -3,18 +3,18 @@ const traverse = require('@babel/traverse').default
3
3
  const t = require('@babel/types')
4
4
  const generate = require('@babel/generator').default
5
5
 
6
- let names = 'Infinity,undefined,NaN,isFinite,isNaN,' +
6
+ const names = 'Infinity,undefined,NaN,isFinite,isNaN,' +
7
7
  'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
8
8
  'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
9
9
  'require,global'
10
10
 
11
- let hash = {}
11
+ const hash = {}
12
12
  names.split(',').forEach(function (name) {
13
13
  hash[name] = true
14
14
  })
15
15
 
16
- let dangerousKeys = 'length,size,prototype'
17
- let dangerousKeyMap = {}
16
+ const dangerousKeys = 'length,size,prototype'
17
+ const dangerousKeyMap = {}
18
18
  dangerousKeys.split(',').forEach((key) => {
19
19
  dangerousKeyMap[key] = true
20
20
  })
@@ -33,7 +33,7 @@ module.exports = {
33
33
  const propKeys = []
34
34
  let isProps = false
35
35
 
36
- let bindThisVisitor = {
36
+ const bindThisVisitor = {
37
37
  // 标记收集props数据
38
38
  CallExpression: {
39
39
  enter (path) {