@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.
- package/lib/config.js +24 -24
- package/lib/dependencies/CommonJsVariableDependency.js +1 -1
- package/lib/dependencies/DynamicEntryDependency.js +18 -11
- package/lib/extractor.js +1 -1
- package/lib/helpers.js +3 -1
- package/lib/index.js +24 -21
- package/lib/json-compiler/helper.js +1 -1
- package/lib/json-compiler/index.js +17 -17
- package/lib/json-compiler/plugin.js +3 -2
- package/lib/json-compiler/theme.js +1 -1
- package/lib/loader.js +3 -3
- package/lib/native-loader.js +1 -1
- package/lib/platform/json/normalize-test.js +3 -1
- package/lib/platform/run-rules.js +2 -2
- package/lib/platform/template/wx/component-config/camera.js +3 -3
- package/lib/platform/template/wx/component-config/canvas.js +5 -5
- package/lib/platform/template/wx/component-config/map.js +5 -5
- package/lib/platform/template/wx/component-config/navigator.js +7 -7
- package/lib/platform/template/wx/component-config/progress.js +4 -4
- package/lib/platform/template/wx/component-config/scroll-view.js +3 -3
- package/lib/platform/template/wx/component-config/slider.js +6 -6
- package/lib/platform/template/wx/component-config/swiper.js +2 -2
- package/lib/platform/template/wx/component-config/video.js +4 -4
- package/lib/platform/template/wx/component-config/view.js +4 -4
- package/lib/platform/template/wx/index.js +45 -13
- package/lib/resolver/PackageEntryPlugin.js +1 -1
- package/lib/runtime/components/web/filterTag.js +6 -6
- package/lib/runtime/components/web/getInnerListeners.js +1 -1
- package/lib/runtime/components/web/mpx-button.vue +0 -1
- package/lib/runtime/components/web/mpx-icon.vue +1 -1
- package/lib/runtime/components/web/mpx-keep-alive.vue +2 -2
- package/lib/runtime/components/web/mpx-picker.vue +1 -1
- package/lib/runtime/components/web/mpx-progress.vue +1 -1
- package/lib/runtime/components/web/mpx-scroll-view.vue +1 -1
- package/lib/runtime/env.js +1 -0
- package/lib/runtime/i18n.wxs +44 -81
- package/lib/runtime/optionProcessor.d.ts +0 -4
- package/lib/runtime/optionProcessor.js +15 -13
- package/lib/runtime/stringify.wxs +3 -3
- package/lib/runtime/swanHelper.wxs +2 -2
- package/lib/runtime/{components/web/util.js → utils.js} +8 -5
- package/lib/script-setup-compiler/index.js +1163 -0
- package/lib/style-compiler/index.js +1 -1
- package/lib/style-compiler/plugins/rpx.js +1 -1
- package/lib/style-compiler/plugins/vw.js +6 -4
- package/lib/template-compiler/bind-this.js +5 -5
- package/lib/template-compiler/compiler.js +122 -179
- package/lib/template-compiler/index.js +3 -3
- package/lib/utils/add-query.js +2 -1
- package/lib/utils/gen-component-tag.js +1 -1
- package/lib/utils/has-own.js +5 -0
- package/lib/utils/is-empty-object.js +2 -1
- package/lib/utils/parse-request.js +3 -3
- package/lib/utils/{index.js → process-defs.js} +3 -10
- package/lib/utils/stringify-query.js +23 -21
- package/lib/web/processJSON.js +5 -5
- package/lib/web/processScript.js +16 -19
- package/lib/web/processTemplate.js +1 -1
- package/lib/wxml/loader.js +3 -3
- package/lib/wxs/i18n-loader.js +4 -11
- package/lib/wxs/pre-loader.js +51 -44
- package/lib/wxss/compile-exports.js +4 -4
- package/lib/wxss/createResolver.js +3 -3
- package/lib/wxss/css-base.js +13 -13
- package/lib/wxss/getLocalIdent.js +5 -4
- package/lib/wxss/loader.js +1 -1
- package/lib/wxss/localsLoader.js +14 -14
- package/lib/wxss/processCss.js +10 -7
- package/package.json +4 -3
- package/lib/utils/env.js +0 -4
- package/lib/utils/parse-asset.js +0 -195
|
@@ -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
|
-
|
|
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'
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
+
const hash = {}
|
|
12
12
|
names.split(',').forEach(function (name) {
|
|
13
13
|
hash[name] = true
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
36
|
+
const bindThisVisitor = {
|
|
37
37
|
// 标记收集props数据
|
|
38
38
|
CallExpression: {
|
|
39
39
|
enter (path) {
|