less-loader 9.1.0 → 10.2.0
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/dist/index.js +32 -6
- package/dist/options.json +10 -5
- package/dist/utils.js +3 -20
- package/package.json +16 -15
package/dist/index.js
CHANGED
|
@@ -25,10 +25,7 @@ async function lessLoader(source) {
|
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
const lessOptions = (0, _utils.getLessOptions)(this, { ...options,
|
|
30
|
-
webpackContextSymbol
|
|
31
|
-
}, implementation);
|
|
28
|
+
const lessOptions = (0, _utils.getLessOptions)(this, options, implementation);
|
|
32
29
|
const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
|
|
33
30
|
|
|
34
31
|
if (useSourceMap) {
|
|
@@ -43,6 +40,26 @@ async function lessLoader(source) {
|
|
|
43
40
|
data = typeof options.additionalData === "function" ? `${await options.additionalData(data, this)}` : `${options.additionalData}\n${data}`;
|
|
44
41
|
}
|
|
45
42
|
|
|
43
|
+
const logger = this.getLogger("less-loader");
|
|
44
|
+
const loggerListener = {
|
|
45
|
+
error(message) {
|
|
46
|
+
logger.error(message);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
warn(message) {
|
|
50
|
+
logger.warn(message);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
info(message) {
|
|
54
|
+
logger.log(message);
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
debug(message) {
|
|
58
|
+
logger.debug(message);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
};
|
|
62
|
+
implementation.logger.addListener(loggerListener);
|
|
46
63
|
let result;
|
|
47
64
|
|
|
48
65
|
try {
|
|
@@ -56,9 +73,13 @@ async function lessLoader(source) {
|
|
|
56
73
|
|
|
57
74
|
callback(new _LessError.default(error));
|
|
58
75
|
return;
|
|
76
|
+
} finally {
|
|
77
|
+
// Fix memory leaks in `less`
|
|
78
|
+
implementation.logger.removeListener(loggerListener);
|
|
79
|
+
delete lessOptions.pluginManager.webpackLoaderContext;
|
|
80
|
+
delete lessOptions.pluginManager;
|
|
59
81
|
}
|
|
60
82
|
|
|
61
|
-
delete implementation[webpackContextSymbol];
|
|
62
83
|
const {
|
|
63
84
|
css,
|
|
64
85
|
imports
|
|
@@ -70,7 +91,12 @@ async function lessLoader(source) {
|
|
|
70
91
|
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
71
92
|
|
|
72
93
|
|
|
73
|
-
|
|
94
|
+
const normalizedItem = _path.default.normalize(item); // Custom `importer` can return only `contents` so item will be relative
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if (_path.default.isAbsolute(normalizedItem)) {
|
|
98
|
+
this.addDependency(normalizedItem);
|
|
99
|
+
}
|
|
74
100
|
});
|
|
75
101
|
let map = typeof result.map === "string" ? JSON.parse(result.map) : result.map;
|
|
76
102
|
|
package/dist/options.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"type": "object",
|
|
4
4
|
"properties": {
|
|
5
5
|
"lessOptions": {
|
|
6
|
-
"description": "Options to pass through to `Less
|
|
6
|
+
"description": "Options to pass through to `Less`.",
|
|
7
|
+
"link": "https://github.com/webpack-contrib/less-loader#lessoptions",
|
|
7
8
|
"anyOf": [
|
|
8
9
|
{
|
|
9
10
|
"type": "object",
|
|
@@ -15,7 +16,8 @@
|
|
|
15
16
|
]
|
|
16
17
|
},
|
|
17
18
|
"additionalData": {
|
|
18
|
-
"description": "Prepends/Appends `Less` code to the actual entry file
|
|
19
|
+
"description": "Prepends/Appends `Less` code to the actual entry file.",
|
|
20
|
+
"link": "https://github.com/webpack-contrib/less-loader#additionalData",
|
|
19
21
|
"anyOf": [
|
|
20
22
|
{
|
|
21
23
|
"type": "string"
|
|
@@ -26,15 +28,18 @@
|
|
|
26
28
|
]
|
|
27
29
|
},
|
|
28
30
|
"sourceMap": {
|
|
29
|
-
"description": "Enables/Disables generation of source maps
|
|
31
|
+
"description": "Enables/Disables generation of source maps.",
|
|
32
|
+
"link": "https://github.com/webpack-contrib/less-loader#sourcemap",
|
|
30
33
|
"type": "boolean"
|
|
31
34
|
},
|
|
32
35
|
"webpackImporter": {
|
|
33
|
-
"description": "Enables/Disables default `webpack` importer
|
|
36
|
+
"description": "Enables/Disables default `webpack` importer.",
|
|
37
|
+
"link": "https://github.com/webpack-contrib/less-loader#webpackimporter",
|
|
34
38
|
"type": "boolean"
|
|
35
39
|
},
|
|
36
40
|
"implementation": {
|
|
37
|
-
"description": "The implementation of the `Less` to be used
|
|
41
|
+
"description": "The implementation of the `Less` to be used.",
|
|
42
|
+
"link": "https://github.com/webpack-contrib/less-loader#implementation",
|
|
38
43
|
"anyOf": [
|
|
39
44
|
{
|
|
40
45
|
"type": "string"
|
package/dist/utils.js
CHANGED
|
@@ -3,15 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getLessImplementation = getLessImplementation;
|
|
6
7
|
exports.getLessOptions = getLessOptions;
|
|
7
8
|
exports.isUnsupportedUrl = isUnsupportedUrl;
|
|
8
9
|
exports.normalizeSourceMap = normalizeSourceMap;
|
|
9
|
-
exports.getLessImplementation = getLessImplementation;
|
|
10
10
|
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
|
|
13
|
-
var _util = _interopRequireDefault(require("util"));
|
|
14
|
-
|
|
15
13
|
var _full = require("klona/full");
|
|
16
14
|
|
|
17
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -180,23 +178,8 @@ function getLessOptions(loaderContext, loaderOptions, implementation) {
|
|
|
180
178
|
lessOptions.plugins.unshift({
|
|
181
179
|
install(lessProcessor, pluginManager) {
|
|
182
180
|
// eslint-disable-next-line no-param-reassign
|
|
183
|
-
pluginManager.webpackLoaderContext = loaderContext;
|
|
184
|
-
|
|
185
|
-
const {
|
|
186
|
-
webpackContextSymbol
|
|
187
|
-
} = options; // eslint-disable-next-line no-param-reassign
|
|
188
|
-
|
|
189
|
-
lessProcessor[webpackContextSymbol] = loaderContext;
|
|
190
|
-
Object.defineProperty(lessProcessor, "webpackLoaderContext", {
|
|
191
|
-
configurable: true,
|
|
192
|
-
|
|
193
|
-
get() {
|
|
194
|
-
_util.default.deprecate(() => {}, "less.webpackLoaderContext is deprecated and will be removed in next major release. Instead use pluginManager.webpackLoaderContext (https://webpack.js.org/loaders/less-loader/#plugins)")();
|
|
195
|
-
|
|
196
|
-
return lessProcessor[webpackContextSymbol];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
});
|
|
181
|
+
pluginManager.webpackLoaderContext = loaderContext;
|
|
182
|
+
lessOptions.pluginManager = pluginManager;
|
|
200
183
|
}
|
|
201
184
|
|
|
202
185
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "A Less loader for webpack. Compiles Less to CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/less-loader",
|
|
@@ -45,28 +45,29 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/cli": "^7.14.5",
|
|
48
|
-
"@babel/core": "^7.14.
|
|
49
|
-
"@babel/preset-env": "^7.14.
|
|
50
|
-
"@commitlint/cli": "^
|
|
51
|
-
"@commitlint/config-conventional": "^
|
|
48
|
+
"@babel/core": "^7.14.6",
|
|
49
|
+
"@babel/preset-env": "^7.14.7",
|
|
50
|
+
"@commitlint/cli": "^13.1.0",
|
|
51
|
+
"@commitlint/config-conventional": "^13.1.0",
|
|
52
52
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
53
|
-
"babel-jest": "^27.0.
|
|
53
|
+
"babel-jest": "^27.0.6",
|
|
54
54
|
"cross-env": "^7.0.3",
|
|
55
55
|
"del": "^6.0.0",
|
|
56
|
-
"del-cli": "^
|
|
57
|
-
"eslint": "^7.
|
|
56
|
+
"del-cli": "^4.0.1",
|
|
57
|
+
"eslint": "^7.30.0",
|
|
58
58
|
"eslint-config-prettier": "^8.3.0",
|
|
59
|
-
"eslint-plugin-import": "^2.
|
|
60
|
-
"husky": "^
|
|
61
|
-
"jest": "^27.0.
|
|
59
|
+
"eslint-plugin-import": "^2.24.1",
|
|
60
|
+
"husky": "^7.0.1",
|
|
61
|
+
"jest": "^27.0.6",
|
|
62
62
|
"less": "^4.1.1",
|
|
63
|
-
"
|
|
63
|
+
"less-plugin-glob": "^3.0.0",
|
|
64
|
+
"lint-staged": "^11.0.1",
|
|
64
65
|
"memfs": "^3.2.2",
|
|
65
66
|
"npm-run-all": "^4.1.5",
|
|
66
|
-
"prettier": "^2.3.
|
|
67
|
-
"standard-version": "^9.3.
|
|
67
|
+
"prettier": "^2.3.2",
|
|
68
|
+
"standard-version": "^9.3.1",
|
|
68
69
|
"strip-ansi": "^7.0.0",
|
|
69
|
-
"webpack": "^5.
|
|
70
|
+
"webpack": "^5.51.1"
|
|
70
71
|
},
|
|
71
72
|
"keywords": [
|
|
72
73
|
"webpack",
|