@mpxjs/webpack-plugin 2.7.54 → 2.7.56
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/json-compiler/index.js +1 -1
- package/lib/loader.js +1 -1
- package/lib/native-loader.js +1 -1
- package/lib/resolver/FixDescriptionInfoPlugin.js +1 -0
- package/lib/utils/get-json-content.js +7 -3
- package/lib/web/processJSON.js +1 -1
- package/lib/wxss/runtime/sourceMaps.js +1 -0
- package/lib/wxss/utils.js +1 -5
- package/package.json +2 -2
|
@@ -274,7 +274,7 @@ module.exports = function (content) {
|
|
|
274
274
|
})
|
|
275
275
|
// 对于通过.mpx文件声明的独立分包,默认将其自身的script block视为init module
|
|
276
276
|
if (queryObj.independent === true) queryObj.independent = result
|
|
277
|
-
getJSONContent(parts.json || {}, this, (err, content) => {
|
|
277
|
+
getJSONContent(parts.json || {}, result, this, (err, content) => {
|
|
278
278
|
callback(err, result, content)
|
|
279
279
|
})
|
|
280
280
|
} else {
|
package/lib/loader.js
CHANGED
|
@@ -91,7 +91,7 @@ module.exports = function (content) {
|
|
|
91
91
|
|
|
92
92
|
async.waterfall([
|
|
93
93
|
(callback) => {
|
|
94
|
-
getJSONContent(parts.json || {}, loaderContext, (err, content) => {
|
|
94
|
+
getJSONContent(parts.json || {}, null, loaderContext, (err, content) => {
|
|
95
95
|
if (err) return callback(err)
|
|
96
96
|
if (parts.json) parts.json.content = content
|
|
97
97
|
callback()
|
package/lib/native-loader.js
CHANGED
|
@@ -4,6 +4,7 @@ module.exports = class FixDescriptionInfoPlugin {
|
|
|
4
4
|
apply (resolver) {
|
|
5
5
|
resolver.hooks.result.tap('FixDescriptionInfoPlugin', (request) => {
|
|
6
6
|
const { path: resourcePath } = request
|
|
7
|
+
if (!resourcePath) return
|
|
7
8
|
const segments = resourcePath.split(path.sep)
|
|
8
9
|
let rootIndex = -1
|
|
9
10
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
@@ -3,14 +3,18 @@ const evalJSONJS = require('./eval-json-js')
|
|
|
3
3
|
const resolve = require('./resolve')
|
|
4
4
|
const async = require('async')
|
|
5
5
|
const { JSON_JS_EXT } = require('./const')
|
|
6
|
+
const path = require('path')
|
|
6
7
|
|
|
7
|
-
module.exports = function getJSONContent (json, loaderContext, callback) {
|
|
8
|
+
module.exports = function getJSONContent (json, filename, loaderContext, callback) {
|
|
8
9
|
if (!loaderContext._compiler) return callback(null, '{}')
|
|
9
10
|
const fs = loaderContext._compiler.inputFileSystem
|
|
11
|
+
filename = filename || loaderContext.resourcePath
|
|
12
|
+
const context = path.dirname(filename)
|
|
13
|
+
|
|
10
14
|
async.waterfall([
|
|
11
15
|
(callback) => {
|
|
12
16
|
if (json.src) {
|
|
13
|
-
resolve(
|
|
17
|
+
resolve(context, json.src, loaderContext, (err, result) => {
|
|
14
18
|
if (err) return callback(err)
|
|
15
19
|
const { rawResourcePath: resourcePath } = parseRequest(result)
|
|
16
20
|
fs.readFile(resourcePath, (err, content) => {
|
|
@@ -27,7 +31,7 @@ module.exports = function getJSONContent (json, loaderContext, callback) {
|
|
|
27
31
|
callback(null, {
|
|
28
32
|
content: json.content,
|
|
29
33
|
useJSONJS: json.useJSONJS,
|
|
30
|
-
filename
|
|
34
|
+
filename
|
|
31
35
|
})
|
|
32
36
|
}
|
|
33
37
|
},
|
package/lib/web/processJSON.js
CHANGED
|
@@ -139,7 +139,7 @@ module.exports = function (json, {
|
|
|
139
139
|
mode,
|
|
140
140
|
env
|
|
141
141
|
})
|
|
142
|
-
getJSONContent(parts.json || {}, loaderContext, (err, content) => {
|
|
142
|
+
getJSONContent(parts.json || {}, result, loaderContext, (err, content) => {
|
|
143
143
|
callback(err, result, content)
|
|
144
144
|
})
|
|
145
145
|
} else {
|
package/lib/wxss/utils.js
CHANGED
|
@@ -1055,7 +1055,6 @@ function getModuleCode (
|
|
|
1055
1055
|
// 符合css后缀名的文件经过mpx处理后会带上相应的后缀防止使用 WebPack 的默认解析规则,此时 require/import 相应路径时,导出的不是一段 css 代码了,事实上是一个文件路径。
|
|
1056
1056
|
const printedParam = printParams(media, dedupe, supports, layer)
|
|
1057
1057
|
const otherParams = printedParam.length > 0 ? printedParam : ''
|
|
1058
|
-
|
|
1059
1058
|
beforeCode += `___CSS_LOADER_EXPORT___.push([module.id, '@import "' + ${item.importName} + '";', ${JSON.stringify(otherParams)} ]);\n`
|
|
1060
1059
|
}
|
|
1061
1060
|
}
|
|
@@ -1231,14 +1230,11 @@ async function resolveRequests (resolve, context, possibleRequests) {
|
|
|
1231
1230
|
})
|
|
1232
1231
|
}
|
|
1233
1232
|
|
|
1234
|
-
|
|
1235
1233
|
function isURLRequestable (url, options = {}) {
|
|
1236
|
-
|
|
1237
1234
|
// 先用 mpx 内部维护方法判断
|
|
1238
|
-
if(
|
|
1235
|
+
if (!isUrlRequest(url, options.root, options.externals)) {
|
|
1239
1236
|
return { requestable: false, needResolve: false }
|
|
1240
1237
|
}
|
|
1241
|
-
|
|
1242
1238
|
// Protocol-relative URLs
|
|
1243
1239
|
if (/^\/\//.test(url)) {
|
|
1244
1240
|
return { requestable: false, needResolve: false }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.56",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=14.14.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "ec0c4c8e63558622a0bd4cf4cf1ca5aafaae1499"
|
|
84
84
|
}
|