@mpxjs/webpack-plugin 2.7.59 → 2.7.62
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/selector.js +1 -1
- package/lib/url-loader.js +1 -10
- package/lib/wxss/loader.js +3 -3
- package/lib/wxss/plugins/postcss-url-parser.js +5 -3
- package/package.json +2 -2
package/lib/selector.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const parseComponent = require('./parser')
|
|
2
2
|
const parseRequest = require('./utils/parse-request')
|
|
3
3
|
const tsWatchRunLoaderFilter = require('./utils/ts-loader-watch-run-loader-filter')
|
|
4
|
-
const path = require(
|
|
4
|
+
const path = require('path')
|
|
5
5
|
|
|
6
6
|
module.exports = function (content) {
|
|
7
7
|
this.cacheable()
|
package/lib/url-loader.js
CHANGED
|
@@ -3,24 +3,15 @@ const mime = require('mime')
|
|
|
3
3
|
const parseRequest = require('./utils/parse-request')
|
|
4
4
|
const getOptions = loaderUtils.getOptions
|
|
5
5
|
|
|
6
|
-
function isStyleRequest (request) {
|
|
7
|
-
const { loaderString, queryObj } = parseRequest(request)
|
|
8
|
-
if (queryObj.type === 'styles') return true
|
|
9
|
-
if (/(css-loader|wxss\/loader)/.test(loaderString)) return true
|
|
10
|
-
return false
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
module.exports = function (src) {
|
|
14
7
|
let transBase64 = false
|
|
15
8
|
const options = Object.assign({}, getOptions(this))
|
|
16
9
|
const { resourcePath, queryObj } = parseRequest(this.resource)
|
|
17
10
|
const mimetype = options.mimetype || mime.getType(resourcePath)
|
|
18
|
-
const moduleGraph = this._compilation.moduleGraph
|
|
19
|
-
const issuer = moduleGraph.getIssuer(this._module)
|
|
20
11
|
const publicPathScope = options.publicPathScope === 'all' ? 'all' : 'styleOnly'
|
|
21
12
|
const limit = options.limit
|
|
22
13
|
const useLocal = !limit || src.length < limit || queryObj.useLocal
|
|
23
|
-
const isStyle =
|
|
14
|
+
const isStyle = queryObj.isStyle
|
|
24
15
|
|
|
25
16
|
if (isStyle) {
|
|
26
17
|
if (options.publicPath) {
|
package/lib/wxss/loader.js
CHANGED
|
@@ -234,18 +234,18 @@ module.exports = async function loader (content, map, meta) {
|
|
|
234
234
|
imports.unshift({
|
|
235
235
|
type: 'api_import',
|
|
236
236
|
importName: '___CSS_LOADER_API_IMPORT___',
|
|
237
|
-
url: stringifyRequest(this, require.resolve('./runtime/api'))
|
|
237
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/api'))
|
|
238
238
|
})
|
|
239
239
|
|
|
240
240
|
if (options.sourceMap) {
|
|
241
241
|
imports.unshift({
|
|
242
242
|
importName: '___CSS_LOADER_API_SOURCEMAP_IMPORT___',
|
|
243
|
-
url: stringifyRequest(this, require.resolve('./runtime/sourceMaps'))
|
|
243
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/sourceMaps'))
|
|
244
244
|
})
|
|
245
245
|
} else {
|
|
246
246
|
imports.unshift({
|
|
247
247
|
importName: '___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___',
|
|
248
|
-
url: stringifyRequest(this, require.resolve('./runtime/noSourceMaps'))
|
|
248
|
+
url: stringifyRequest(this, '!!' + require.resolve('./runtime/noSourceMaps'))
|
|
249
249
|
})
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -8,6 +8,8 @@ const {
|
|
|
8
8
|
WEBPACK_IGNORE_COMMENT_REGEXP
|
|
9
9
|
} = require('../utils')
|
|
10
10
|
|
|
11
|
+
const addQuery = require('../../utils/add-query')
|
|
12
|
+
|
|
11
13
|
const isUrlFunc = /url/i
|
|
12
14
|
const isImageSetFunc = /^(?:-webkit-)?image-set$/i
|
|
13
15
|
const needParseDeclaration = /(?:url|(?:-webkit-)?image-set)\(/i
|
|
@@ -402,13 +404,13 @@ const plugin = (options = {}) => {
|
|
|
402
404
|
if (!importName) {
|
|
403
405
|
importName = `___CSS_LOADER_URL_IMPORT_${urlToNameMap.size}___`
|
|
404
406
|
urlToNameMap.set(newUrl, importName)
|
|
405
|
-
|
|
407
|
+
const finalUrl = addQuery(newUrl, { isStyle: true })
|
|
406
408
|
options.imports.push({
|
|
407
409
|
type: 'url',
|
|
408
410
|
importName,
|
|
409
411
|
url: options.resolver
|
|
410
|
-
? options.urlHandler(
|
|
411
|
-
: JSON.stringify(
|
|
412
|
+
? options.urlHandler(finalUrl)
|
|
413
|
+
: JSON.stringify(finalUrl),
|
|
412
414
|
index
|
|
413
415
|
})
|
|
414
416
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.62",
|
|
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": "c90b20b6693ca07385fe131aea7f484c19ba3b8c"
|
|
84
84
|
}
|