css-loader 3.2.0 → 3.2.1
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/CHANGELOG.md +8 -0
- package/README.md +15 -15
- package/dist/index.js +2 -2
- package/dist/runtime/getUrl.js +13 -3
- package/dist/utils.js +15 -2
- package/package.json +31 -30
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [3.2.1](https://github.com/webpack-contrib/css-loader/compare/v3.2.0...v3.2.1) (2019-12-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add an additional space after the escape sequence ([#998](https://github.com/webpack-contrib/css-loader/issues/998)) ([0961304](https://github.com/webpack-contrib/css-loader/commit/0961304020832fc9ca70cc708f4366e1f868e765))
|
|
11
|
+
* compatibility with ES modules syntax and hash in `url` function ([#1001](https://github.com/webpack-contrib/css-loader/issues/1001)) ([8f4d6f5](https://github.com/webpack-contrib/css-loader/commit/8f4d6f508187513347106a436eda993f874065f1))
|
|
12
|
+
|
|
5
13
|
## [3.2.0](https://github.com/webpack-contrib/css-loader/compare/v3.1.0...v3.2.0) (2019-08-06)
|
|
6
14
|
|
|
7
15
|
|
package/README.md
CHANGED
|
@@ -109,15 +109,15 @@ module.exports = {
|
|
|
109
109
|
|
|
110
110
|
## Options
|
|
111
111
|
|
|
112
|
-
| Name | Type | Default
|
|
113
|
-
| :-----------------------------------------: | :-------------------------: |
|
|
114
|
-
| **[`url`](#url)** | `{Boolean\|Function}` |
|
|
115
|
-
| **[`import`](#import)** | `{Boolean\|Function}` |
|
|
116
|
-
| **[`modules`](#modules)** | `{Boolean\|String\|Object}` | `false`
|
|
117
|
-
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false`
|
|
118
|
-
| **[`importLoaders`](#importloaders)** | `{Number}` | `0`
|
|
119
|
-
| **[`localsConvention`](#localsconvention)** | `{String}` | `asIs`
|
|
120
|
-
| **[`onlyLocals`](#onlylocals)** | `{Boolean}` | `false`
|
|
112
|
+
| Name | Type | Default | Description |
|
|
113
|
+
| :-----------------------------------------: | :-------------------------: | :------: | :--------------------------------------------------------------------- |
|
|
114
|
+
| **[`url`](#url)** | `{Boolean\|Function}` | `true` | Enables/Disables `url`/`image-set` functions handling |
|
|
115
|
+
| **[`import`](#import)** | `{Boolean\|Function}` | `true` | Enables/Disables `@import` at-rules handling |
|
|
116
|
+
| **[`modules`](#modules)** | `{Boolean\|String\|Object}` | `false` | Enables/Disables CSS Modules and their configuration |
|
|
117
|
+
| **[`sourceMap`](#sourcemap)** | `{Boolean}` | `false` | Enables/Disables generation of source maps |
|
|
118
|
+
| **[`importLoaders`](#importloaders)** | `{Number}` | `0` | Enables/Disables or setups number of loaders applied before CSS loader |
|
|
119
|
+
| **[`localsConvention`](#localsconvention)** | `{String}` | `'asIs'` | Style of exported classnames |
|
|
120
|
+
| **[`onlyLocals`](#onlylocals)** | `{Boolean}` | `false` | Export only locals |
|
|
121
121
|
|
|
122
122
|
### `url`
|
|
123
123
|
|
|
@@ -201,7 +201,7 @@ module.exports = {
|
|
|
201
201
|
|
|
202
202
|
### `import`
|
|
203
203
|
|
|
204
|
-
Type: `Boolean`
|
|
204
|
+
Type: `Boolean|Function`
|
|
205
205
|
Default: `true`
|
|
206
206
|
|
|
207
207
|
Enables/Disables `@import` at-rules handling.
|
|
@@ -540,7 +540,7 @@ module.exports = {
|
|
|
540
540
|
##### `mode`
|
|
541
541
|
|
|
542
542
|
Type: `String`
|
|
543
|
-
Default: `local`
|
|
543
|
+
Default: `'local'`
|
|
544
544
|
|
|
545
545
|
Setup `mode` option. You can omit the value when you want `local` mode.
|
|
546
546
|
|
|
@@ -567,15 +567,15 @@ module.exports = {
|
|
|
567
567
|
##### `localIdentName`
|
|
568
568
|
|
|
569
569
|
Type: `String`
|
|
570
|
-
Default: `[hash:base64]`
|
|
570
|
+
Default: `'[hash:base64]'`
|
|
571
571
|
|
|
572
572
|
You can configure the generated ident with the `localIdentName` query parameter.
|
|
573
573
|
See [loader-utils's documentation](https://github.com/webpack/loader-utils#interpolatename) for more information on options.
|
|
574
574
|
|
|
575
575
|
Recommendations:
|
|
576
576
|
|
|
577
|
-
- use `[path][name]__[local]` for development
|
|
578
|
-
- use `[hash:base64]` for production
|
|
577
|
+
- use `'[path][name]__[local]'` for development
|
|
578
|
+
- use `'[hash:base64]'` for production
|
|
579
579
|
|
|
580
580
|
The `[local]` placeholder contains original class.
|
|
581
581
|
|
|
@@ -782,7 +782,7 @@ This may change in the future when the module system (i. e. webpack) supports lo
|
|
|
782
782
|
### `localsConvention`
|
|
783
783
|
|
|
784
784
|
Type: `String`
|
|
785
|
-
Default: `
|
|
785
|
+
Default: `'asIs'`
|
|
786
786
|
|
|
787
787
|
Style of exported classnames.
|
|
788
788
|
|
package/dist/index.js
CHANGED
|
@@ -82,8 +82,8 @@ function loader(content, map, meta) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
(0, _postcss.default)(plugins).process(content, {
|
|
85
|
-
from:
|
|
86
|
-
to:
|
|
85
|
+
from: this.remainingRequest.split('!').pop(),
|
|
86
|
+
to: this.currentRequest.split('!').pop(),
|
|
87
87
|
map: options.sourceMap ? {
|
|
88
88
|
prev: map,
|
|
89
89
|
inline: false,
|
package/dist/runtime/getUrl.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
module.exports = function (url,
|
|
4
|
-
|
|
3
|
+
module.exports = function (url, options) {
|
|
4
|
+
if (!options) {
|
|
5
|
+
// eslint-disable-next-line no-param-reassign
|
|
6
|
+
options = {};
|
|
7
|
+
} // eslint-disable-next-line no-underscore-dangle, no-param-reassign
|
|
8
|
+
|
|
9
|
+
|
|
5
10
|
url = url.__esModule ? url.default : url;
|
|
6
11
|
|
|
7
12
|
if (typeof url !== 'string') {
|
|
@@ -12,11 +17,16 @@ module.exports = function (url, needQuotes) {
|
|
|
12
17
|
if (/^['"].*['"]$/.test(url)) {
|
|
13
18
|
// eslint-disable-next-line no-param-reassign
|
|
14
19
|
url = url.slice(1, -1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (options.hash) {
|
|
23
|
+
// eslint-disable-next-line no-param-reassign
|
|
24
|
+
url += options.hash;
|
|
15
25
|
} // Should url be wrapped?
|
|
16
26
|
// See https://drafts.csswg.org/css-values-3/#urls
|
|
17
27
|
|
|
18
28
|
|
|
19
|
-
if (/["'() \t\n]/.test(url) || needQuotes) {
|
|
29
|
+
if (/["'() \t\n]/.test(url) || options.needQuotes) {
|
|
20
30
|
return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, '\\n'), "\"");
|
|
21
31
|
}
|
|
22
32
|
|
package/dist/utils.js
CHANGED
|
@@ -39,7 +39,9 @@ var _postcssModulesScope = _interopRequireDefault(require("postcss-modules-scope
|
|
|
39
39
|
|
|
40
40
|
var _camelcase = _interopRequireDefault(require("camelcase"));
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
43
|
+
|
|
44
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
43
45
|
|
|
44
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
47
|
|
|
@@ -215,7 +217,18 @@ function getUrlItemCode(item, loaderContext) {
|
|
|
215
217
|
|
|
216
218
|
const [normalizedUrl, singleQuery, hashValue] = url.split(/(\?)?#/);
|
|
217
219
|
const hash = singleQuery || hashValue ? `"${singleQuery ? '?' : ''}${hashValue ? `#${hashValue}` : ''}"` : '';
|
|
218
|
-
|
|
220
|
+
const options = [];
|
|
221
|
+
|
|
222
|
+
if (hash) {
|
|
223
|
+
options.push(`hash: ${hash}`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (needQuotes) {
|
|
227
|
+
options.push(`needQuotes: true`);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const preparedOptions = options.length > 0 ? `, { ${options.join(', ')} }` : '';
|
|
231
|
+
return `var ${placeholder} = getUrl(require(${(0, _loaderUtils.stringifyRequest)(loaderContext, (0, _loaderUtils.urlToRequest)(normalizedUrl))})${preparedOptions});`;
|
|
219
232
|
}
|
|
220
233
|
|
|
221
234
|
function getApiCode(loaderContext, sourceMap, onlyLocals) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-loader",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "css loader module for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/css-loader",
|
|
@@ -46,46 +46,47 @@
|
|
|
46
46
|
"icss-utils": "^4.1.1",
|
|
47
47
|
"loader-utils": "^1.2.3",
|
|
48
48
|
"normalize-path": "^3.0.0",
|
|
49
|
-
"postcss": "^7.0.
|
|
49
|
+
"postcss": "^7.0.23",
|
|
50
50
|
"postcss-modules-extract-imports": "^2.0.0",
|
|
51
51
|
"postcss-modules-local-by-default": "^3.0.2",
|
|
52
|
-
"postcss-modules-scope": "^2.1.
|
|
52
|
+
"postcss-modules-scope": "^2.1.1",
|
|
53
53
|
"postcss-modules-values": "^3.0.0",
|
|
54
|
-
"postcss-value-parser": "^4.0.
|
|
55
|
-
"schema-utils": "^2.
|
|
54
|
+
"postcss-value-parser": "^4.0.2",
|
|
55
|
+
"schema-utils": "^2.6.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@babel/cli": "^7.
|
|
59
|
-
"@babel/core": "^7.
|
|
60
|
-
"@babel/preset-env": "^7.
|
|
61
|
-
"@commitlint/cli": "^8.
|
|
62
|
-
"@commitlint/config-conventional": "^8.
|
|
58
|
+
"@babel/cli": "^7.7.4",
|
|
59
|
+
"@babel/core": "^7.7.4",
|
|
60
|
+
"@babel/preset-env": "^7.7.4",
|
|
61
|
+
"@commitlint/cli": "^8.2.0",
|
|
62
|
+
"@commitlint/config-conventional": "^8.2.0",
|
|
63
63
|
"@webpack-contrib/defaults": "^5.0.2",
|
|
64
64
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
65
|
-
"babel-jest": "^24.
|
|
65
|
+
"babel-jest": "^24.9.0",
|
|
66
66
|
"commitlint-azure-pipelines-cli": "^1.0.2",
|
|
67
|
-
"cross-env": "^
|
|
68
|
-
"del": "^5.
|
|
69
|
-
"del-cli": "^
|
|
70
|
-
"es-check": "^5.
|
|
71
|
-
"eslint": "^6.1
|
|
72
|
-
"eslint-config-prettier": "^6.
|
|
73
|
-
"eslint-plugin-import": "^2.18.
|
|
74
|
-
"file-loader": "^
|
|
75
|
-
"husky": "^3.
|
|
76
|
-
"jest": "^24.
|
|
77
|
-
"jest-junit": "^
|
|
78
|
-
"lint-staged": "^9.
|
|
79
|
-
"memory-fs": "^0.
|
|
67
|
+
"cross-env": "^6.0.3",
|
|
68
|
+
"del": "^5.1.0",
|
|
69
|
+
"del-cli": "^3.0.0",
|
|
70
|
+
"es-check": "^5.1.0",
|
|
71
|
+
"eslint": "^6.7.1",
|
|
72
|
+
"eslint-config-prettier": "^6.7.0",
|
|
73
|
+
"eslint-plugin-import": "^2.18.2",
|
|
74
|
+
"file-loader": "^5.0.2",
|
|
75
|
+
"husky": "^3.1.0",
|
|
76
|
+
"jest": "^24.9.0",
|
|
77
|
+
"jest-junit": "^9.0.0",
|
|
78
|
+
"lint-staged": "^9.5.0",
|
|
79
|
+
"memory-fs": "^0.5.0",
|
|
80
80
|
"npm-run-all": "^4.1.5",
|
|
81
81
|
"postcss-loader": "^3.0.0",
|
|
82
82
|
"postcss-preset-env": "^6.7.0",
|
|
83
|
-
"prettier": "^1.
|
|
84
|
-
"sass": "^1.
|
|
85
|
-
"sass-loader": "^
|
|
86
|
-
"standard-version": "^7.0.
|
|
87
|
-
"strip-ansi": "^
|
|
88
|
-
"
|
|
83
|
+
"prettier": "^1.19.1",
|
|
84
|
+
"sass": "^1.23.7",
|
|
85
|
+
"sass-loader": "^8.0.0",
|
|
86
|
+
"standard-version": "^7.0.1",
|
|
87
|
+
"strip-ansi": "^6.0.0",
|
|
88
|
+
"url-loader": "^3.0.0",
|
|
89
|
+
"webpack": "^4.41.2"
|
|
89
90
|
},
|
|
90
91
|
"keywords": [
|
|
91
92
|
"webpack",
|