less-loader 11.1.0 → 11.1.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/README.md +3 -3
- package/dist/index.js +13 -30
- package/dist/utils.js +49 -60
- package/package.json +22 -17
- package/dist/LessError.js +0 -38
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[![node][node]][node-url]
|
|
9
9
|
[![tests][tests]][tests-url]
|
|
10
10
|
[![cover][cover]][cover-url]
|
|
11
|
-
[![
|
|
11
|
+
[![discussion][discussion]][discussion-url]
|
|
12
12
|
[![size][size]][size-url]
|
|
13
13
|
|
|
14
14
|
# less-loader
|
|
@@ -633,7 +633,7 @@ Please take a moment to read our contributing guidelines if you haven't yet done
|
|
|
633
633
|
[tests-url]: https://github.com/webpack-contrib/less-loader/actions
|
|
634
634
|
[cover]: https://codecov.io/gh/webpack-contrib/less-loader/branch/master/graph/badge.svg
|
|
635
635
|
[cover-url]: https://codecov.io/gh/webpack-contrib/less-loader
|
|
636
|
-
[
|
|
637
|
-
[
|
|
636
|
+
[discussion]: https://img.shields.io/github/discussions/webpack/webpack
|
|
637
|
+
[discussion-url]: https://github.com/webpack/webpack/discussions
|
|
638
638
|
[size]: https://packagephobia.now.sh/badge?p=less-loader
|
|
639
639
|
[size-url]: https://packagephobia.now.sh/result?p=less-loader
|
package/dist/index.js
CHANGED
|
@@ -4,64 +4,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
8
|
var _options = _interopRequireDefault(require("./options.json"));
|
|
11
|
-
|
|
12
9
|
var _utils = require("./utils");
|
|
13
|
-
|
|
14
|
-
var _LessError = _interopRequireDefault(require("./LessError"));
|
|
15
|
-
|
|
16
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
11
|
async function lessLoader(source) {
|
|
19
12
|
const options = this.getOptions(_options.default);
|
|
20
13
|
const callback = this.async();
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
let implementation;
|
|
15
|
+
try {
|
|
16
|
+
implementation = (0, _utils.getLessImplementation)(this, options.implementation);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
callback(error);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
23
21
|
if (!implementation) {
|
|
24
22
|
callback(new Error(`The Less implementation "${options.implementation}" not found`));
|
|
25
23
|
return;
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
const lessOptions = (0, _utils.getLessOptions)(this, options, implementation);
|
|
29
26
|
const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
|
|
30
|
-
|
|
31
27
|
if (useSourceMap) {
|
|
32
28
|
lessOptions.sourceMap = {
|
|
33
29
|
outputSourceFiles: true
|
|
34
30
|
};
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
let data = source;
|
|
38
|
-
|
|
39
33
|
if (typeof options.additionalData !== "undefined") {
|
|
40
34
|
data = typeof options.additionalData === "function" ? `${await options.additionalData(data, this)}` : `${options.additionalData}\n${data}`;
|
|
41
35
|
}
|
|
42
|
-
|
|
43
36
|
const logger = this.getLogger("less-loader");
|
|
44
37
|
const loggerListener = {
|
|
45
38
|
error(message) {
|
|
46
39
|
logger.error(message);
|
|
47
40
|
},
|
|
48
|
-
|
|
49
41
|
warn(message) {
|
|
50
42
|
logger.warn(message);
|
|
51
43
|
},
|
|
52
|
-
|
|
53
44
|
info(message) {
|
|
54
45
|
logger.log(message);
|
|
55
46
|
},
|
|
56
|
-
|
|
57
47
|
debug(message) {
|
|
58
48
|
logger.debug(message);
|
|
59
49
|
}
|
|
60
|
-
|
|
61
50
|
};
|
|
62
51
|
implementation.logger.addListener(loggerListener);
|
|
63
52
|
let result;
|
|
64
|
-
|
|
65
53
|
try {
|
|
66
54
|
result = await implementation.render(data, lessOptions);
|
|
67
55
|
} catch (error) {
|
|
@@ -70,8 +58,7 @@ async function lessLoader(source) {
|
|
|
70
58
|
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
71
59
|
this.addDependency(_path.default.normalize(error.filename));
|
|
72
60
|
}
|
|
73
|
-
|
|
74
|
-
callback(new _LessError.default(error));
|
|
61
|
+
callback((0, _utils.errorFactory)(error));
|
|
75
62
|
return;
|
|
76
63
|
} finally {
|
|
77
64
|
// Fix memory leaks in `less`
|
|
@@ -79,7 +66,6 @@ async function lessLoader(source) {
|
|
|
79
66
|
delete lessOptions.pluginManager.webpackLoaderContext;
|
|
80
67
|
delete lessOptions.pluginManager;
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
const {
|
|
84
70
|
css,
|
|
85
71
|
imports
|
|
@@ -87,25 +73,22 @@ async function lessLoader(source) {
|
|
|
87
73
|
imports.forEach(item => {
|
|
88
74
|
if ((0, _utils.isUnsupportedUrl)(item)) {
|
|
89
75
|
return;
|
|
90
|
-
}
|
|
91
|
-
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const normalizedItem = _path.default.normalize(item); // Custom `importer` can return only `contents` so item will be relative
|
|
76
|
+
}
|
|
95
77
|
|
|
78
|
+
// `less` return forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
|
|
79
|
+
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
|
|
80
|
+
const normalizedItem = _path.default.normalize(item);
|
|
96
81
|
|
|
82
|
+
// Custom `importer` can return only `contents` so item will be relative
|
|
97
83
|
if (_path.default.isAbsolute(normalizedItem)) {
|
|
98
84
|
this.addDependency(normalizedItem);
|
|
99
85
|
}
|
|
100
86
|
});
|
|
101
87
|
let map = typeof result.map === "string" ? JSON.parse(result.map) : result.map;
|
|
102
|
-
|
|
103
88
|
if (map && useSourceMap) {
|
|
104
89
|
map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
|
|
105
90
|
}
|
|
106
|
-
|
|
107
91
|
callback(null, css, map);
|
|
108
92
|
}
|
|
109
|
-
|
|
110
93
|
var _default = lessLoader;
|
|
111
94
|
exports.default = _default;
|
package/dist/utils.js
CHANGED
|
@@ -3,34 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.errorFactory = errorFactory;
|
|
6
7
|
exports.getLessImplementation = getLessImplementation;
|
|
7
8
|
exports.getLessOptions = getLessOptions;
|
|
8
9
|
exports.isUnsupportedUrl = isUnsupportedUrl;
|
|
9
10
|
exports.normalizeSourceMap = normalizeSourceMap;
|
|
10
|
-
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
|
-
|
|
13
12
|
var _full = require("klona/full");
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
14
|
/* eslint-disable class-methods-use-this */
|
|
18
|
-
const trailingSlash = /[/\\]$/;
|
|
15
|
+
const trailingSlash = /[/\\]$/;
|
|
16
|
+
|
|
17
|
+
// This somewhat changed in Less 3.x. Now the file name comes without the
|
|
19
18
|
// automatically added extension whereas the extension is passed in as `options.ext`.
|
|
20
19
|
// So, if the file name matches this regexp, we simply ignore the proposed extension.
|
|
20
|
+
const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/;
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
// `[drive_letter]:\` + `\\[server]\[share_name]\`
|
|
23
|
+
const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
// Examples:
|
|
25
26
|
// - ~package
|
|
26
27
|
// - ~package/
|
|
27
28
|
// - ~@org
|
|
28
29
|
// - ~@org/
|
|
29
30
|
// - ~@org/package
|
|
30
31
|
// - ~@org/package/
|
|
31
|
-
|
|
32
32
|
const IS_MODULE_IMPORT = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
|
|
33
33
|
const MODULE_REQUEST_REGEX = /^[^?]*~/;
|
|
34
|
+
|
|
34
35
|
/**
|
|
35
36
|
* Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.
|
|
36
37
|
*
|
|
@@ -38,7 +39,6 @@ const MODULE_REQUEST_REGEX = /^[^?]*~/;
|
|
|
38
39
|
* @param {object} implementation
|
|
39
40
|
* @returns {LessPlugin}
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
42
|
function createWebpackLessPlugin(loaderContext, implementation) {
|
|
43
43
|
const resolve = loaderContext.getResolve({
|
|
44
44
|
dependencyType: "less",
|
|
@@ -48,108 +48,89 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
48
48
|
extensions: [".less", ".css"],
|
|
49
49
|
preferRelative: true
|
|
50
50
|
});
|
|
51
|
-
|
|
52
51
|
class WebpackFileManager extends implementation.FileManager {
|
|
53
52
|
supports(filename) {
|
|
54
53
|
if (filename[0] === "/" || IS_NATIVE_WIN32_PATH.test(filename)) {
|
|
55
54
|
return true;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
56
|
if (this.isPathAbsolute(filename)) {
|
|
59
57
|
return false;
|
|
60
58
|
}
|
|
61
|
-
|
|
62
59
|
return true;
|
|
63
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Sync resolving is used at least by the `data-uri` function.
|
|
64
63
|
// This file manager doesn't know how to do it, so let's delegate it
|
|
65
64
|
// to the default file manager of Less.
|
|
66
65
|
// We could probably use loaderContext.resolveSync, but it's deprecated,
|
|
67
66
|
// see https://webpack.js.org/api/loaders/#this-resolvesync
|
|
68
|
-
|
|
69
|
-
|
|
70
67
|
supportsSync() {
|
|
71
68
|
return false;
|
|
72
69
|
}
|
|
73
|
-
|
|
74
70
|
async resolveFilename(filename, currentDirectory) {
|
|
75
71
|
// Less is giving us trailing slashes, but the context should have no trailing slash
|
|
76
72
|
const context = currentDirectory.replace(trailingSlash, "");
|
|
77
|
-
let request = filename;
|
|
73
|
+
let request = filename;
|
|
78
74
|
|
|
75
|
+
// A `~` makes the url an module
|
|
79
76
|
if (MODULE_REQUEST_REGEX.test(filename)) {
|
|
80
77
|
request = request.replace(MODULE_REQUEST_REGEX, "");
|
|
81
78
|
}
|
|
82
|
-
|
|
83
79
|
if (IS_MODULE_IMPORT.test(filename)) {
|
|
84
80
|
request = request[request.length - 1] === "/" ? request : `${request}/`;
|
|
85
81
|
}
|
|
86
|
-
|
|
87
82
|
return this.resolveRequests(context, [...new Set([request, filename])]);
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
async resolveRequests(context, possibleRequests) {
|
|
91
85
|
if (possibleRequests.length === 0) {
|
|
92
86
|
return Promise.reject();
|
|
93
87
|
}
|
|
94
|
-
|
|
95
88
|
let result;
|
|
96
|
-
|
|
97
89
|
try {
|
|
98
90
|
result = await resolve(context, possibleRequests[0]);
|
|
99
91
|
} catch (error) {
|
|
100
92
|
const [, ...tailPossibleRequests] = possibleRequests;
|
|
101
|
-
|
|
102
93
|
if (tailPossibleRequests.length === 0) {
|
|
103
94
|
throw error;
|
|
104
95
|
}
|
|
105
|
-
|
|
106
96
|
result = await this.resolveRequests(context, tailPossibleRequests);
|
|
107
97
|
}
|
|
108
|
-
|
|
109
98
|
return result;
|
|
110
99
|
}
|
|
111
|
-
|
|
112
100
|
async loadFile(filename, ...args) {
|
|
113
101
|
let result;
|
|
114
|
-
|
|
115
102
|
try {
|
|
116
103
|
if (IS_SPECIAL_MODULE_IMPORT.test(filename)) {
|
|
117
104
|
const error = new Error();
|
|
118
105
|
error.type = "Next";
|
|
119
106
|
throw error;
|
|
120
107
|
}
|
|
121
|
-
|
|
122
108
|
result = await super.loadFile(filename, ...args);
|
|
123
109
|
} catch (error) {
|
|
124
110
|
if (error.type !== "File" && error.type !== "Next") {
|
|
125
111
|
return Promise.reject(error);
|
|
126
112
|
}
|
|
127
|
-
|
|
128
113
|
try {
|
|
129
114
|
result = await this.resolveFilename(filename, ...args);
|
|
130
115
|
} catch (webpackResolveError) {
|
|
131
116
|
error.message = `Less resolver error:\n${error.message}\n\n` + `Webpack resolver error details:\n${webpackResolveError.details}\n\n` + `Webpack resolver error missing:\n${webpackResolveError.missing}\n\n`;
|
|
132
117
|
return Promise.reject(error);
|
|
133
118
|
}
|
|
134
|
-
|
|
135
119
|
loaderContext.addDependency(result);
|
|
136
120
|
return super.loadFile(result, ...args);
|
|
137
121
|
}
|
|
138
|
-
|
|
139
122
|
loaderContext.addDependency(_path.default.normalize(result.filename));
|
|
140
123
|
return result;
|
|
141
124
|
}
|
|
142
|
-
|
|
143
125
|
}
|
|
144
|
-
|
|
145
126
|
return {
|
|
146
127
|
install(lessInstance, pluginManager) {
|
|
147
128
|
pluginManager.addFileManager(new WebpackFileManager());
|
|
148
129
|
},
|
|
149
|
-
|
|
150
130
|
minVersion: [3, 0, 0]
|
|
151
131
|
};
|
|
152
132
|
}
|
|
133
|
+
|
|
153
134
|
/**
|
|
154
135
|
* Get the less options from the loader context and normalizes its values
|
|
155
136
|
*
|
|
@@ -158,8 +139,6 @@ function createWebpackLessPlugin(loaderContext, implementation) {
|
|
|
158
139
|
* @param {object} implementation
|
|
159
140
|
* @returns {Object}
|
|
160
141
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
142
|
function getLessOptions(loaderContext, loaderOptions, implementation) {
|
|
164
143
|
const options = (0, _full.klona)(typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {});
|
|
165
144
|
const lessOptions = {
|
|
@@ -170,63 +149,73 @@ function getLessOptions(loaderContext, loaderOptions, implementation) {
|
|
|
170
149
|
...options
|
|
171
150
|
};
|
|
172
151
|
const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" ? loaderOptions.webpackImporter : true;
|
|
173
|
-
|
|
174
152
|
if (shouldUseWebpackImporter) {
|
|
175
153
|
lessOptions.plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
lessOptions.plugins.unshift({
|
|
179
156
|
install(lessProcessor, pluginManager) {
|
|
180
157
|
// eslint-disable-next-line no-param-reassign
|
|
181
158
|
pluginManager.webpackLoaderContext = loaderContext;
|
|
182
159
|
lessOptions.pluginManager = pluginManager;
|
|
183
160
|
}
|
|
184
|
-
|
|
185
161
|
});
|
|
186
162
|
return lessOptions;
|
|
187
163
|
}
|
|
188
|
-
|
|
189
164
|
function isUnsupportedUrl(url) {
|
|
190
165
|
// Is Windows path
|
|
191
166
|
if (IS_NATIVE_WIN32_PATH.test(url)) {
|
|
192
167
|
return false;
|
|
193
|
-
}
|
|
194
|
-
// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
|
195
|
-
|
|
168
|
+
}
|
|
196
169
|
|
|
170
|
+
// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
|
|
171
|
+
// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
|
197
172
|
return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
|
|
198
173
|
}
|
|
199
|
-
|
|
200
174
|
function normalizeSourceMap(map) {
|
|
201
|
-
const newMap = map;
|
|
175
|
+
const newMap = map;
|
|
176
|
+
|
|
177
|
+
// map.file is an optional property that provides the output filename.
|
|
202
178
|
// Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
|
|
203
179
|
// eslint-disable-next-line no-param-reassign
|
|
180
|
+
delete newMap.file;
|
|
204
181
|
|
|
205
|
-
delete newMap.file; // eslint-disable-next-line no-param-reassign
|
|
206
|
-
|
|
207
|
-
newMap.sourceRoot = ""; // `less` returns POSIX paths, that's why we need to transform them back to native paths.
|
|
208
182
|
// eslint-disable-next-line no-param-reassign
|
|
183
|
+
newMap.sourceRoot = "";
|
|
209
184
|
|
|
185
|
+
// `less` returns POSIX paths, that's why we need to transform them back to native paths.
|
|
186
|
+
// eslint-disable-next-line no-param-reassign
|
|
210
187
|
newMap.sources = newMap.sources.map(source => _path.default.normalize(source));
|
|
211
188
|
return newMap;
|
|
212
189
|
}
|
|
213
|
-
|
|
214
190
|
function getLessImplementation(loaderContext, implementation) {
|
|
215
191
|
let resolvedImplementation = implementation;
|
|
216
|
-
|
|
217
192
|
if (!implementation || typeof implementation === "string") {
|
|
218
193
|
const lessImplPkg = implementation || "less";
|
|
219
194
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
} catch (error) {
|
|
224
|
-
loaderContext.emitError(error); // eslint-disable-next-line consistent-return
|
|
225
|
-
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
} // eslint-disable-next-line consistent-return
|
|
229
|
-
|
|
195
|
+
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
196
|
+
resolvedImplementation = require(lessImplPkg);
|
|
197
|
+
}
|
|
230
198
|
|
|
199
|
+
// eslint-disable-next-line consistent-return
|
|
231
200
|
return resolvedImplementation;
|
|
201
|
+
}
|
|
202
|
+
function getFileExcerptIfPossible(error) {
|
|
203
|
+
if (typeof error.extract === "undefined") {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
const excerpt = error.extract.slice(0, 2);
|
|
207
|
+
const column = Math.max(error.column - 1, 0);
|
|
208
|
+
if (typeof excerpt[0] === "undefined") {
|
|
209
|
+
excerpt.shift();
|
|
210
|
+
}
|
|
211
|
+
excerpt.push(`${new Array(column).join(" ")}^`);
|
|
212
|
+
return excerpt;
|
|
213
|
+
}
|
|
214
|
+
function errorFactory(error) {
|
|
215
|
+
const message = ["\n", ...getFileExcerptIfPossible(error), error.message.charAt(0).toUpperCase() + error.message.slice(1), error.filename ? ` Error in ${_path.default.normalize(error.filename)} (line ${error.line}, column ${error.column})` : ""].join("\n");
|
|
216
|
+
const obj = new Error(message, {
|
|
217
|
+
cause: error
|
|
218
|
+
});
|
|
219
|
+
obj.stack = null;
|
|
220
|
+
return obj;
|
|
232
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "less-loader",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.2",
|
|
4
4
|
"description": "A Less loader for webpack. Compiles Less to CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/less-loader",
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
"security": "npm audit --production",
|
|
25
25
|
"lint:prettier": "prettier --list-different .",
|
|
26
26
|
"lint:js": "eslint --cache .",
|
|
27
|
+
"lint:spelling": "cspell \"**/*.*\"",
|
|
27
28
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
29
|
+
"fix:js": "npm run lint:js -- --fix",
|
|
30
|
+
"fix:prettier": "npm run lint:prettier -- --write",
|
|
31
|
+
"fix": "npm-run-all -l fix:js fix:prettier",
|
|
28
32
|
"test:only": "cross-env NODE_ENV=test jest",
|
|
29
33
|
"test:watch": "npm run test:only -- --watch",
|
|
30
34
|
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
|
|
@@ -41,33 +45,34 @@
|
|
|
41
45
|
"webpack": "^5.0.0"
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
44
|
-
"klona": "^2.0.
|
|
48
|
+
"klona": "^2.0.6"
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|
|
47
|
-
"@babel/cli": "^7.
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@babel/preset-env": "^7.
|
|
50
|
-
"@commitlint/cli": "^17.1
|
|
51
|
-
"@commitlint/config-conventional": "^17.1
|
|
51
|
+
"@babel/cli": "^7.21.5",
|
|
52
|
+
"@babel/core": "^7.21.5",
|
|
53
|
+
"@babel/preset-env": "^7.21.5",
|
|
54
|
+
"@commitlint/cli": "^17.6.1",
|
|
55
|
+
"@commitlint/config-conventional": "^17.6.1",
|
|
52
56
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
53
|
-
"babel-jest": "^29.
|
|
57
|
+
"babel-jest": "^29.5.0",
|
|
54
58
|
"cross-env": "^7.0.3",
|
|
59
|
+
"cspell": "^6.31.1",
|
|
55
60
|
"del": "^6.1.1",
|
|
56
61
|
"del-cli": "^4.0.1",
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"eslint-config-prettier": "^8.
|
|
59
|
-
"eslint-plugin-import": "^2.
|
|
60
|
-
"husky": "^8.0.
|
|
61
|
-
"jest": "^29.
|
|
62
|
+
"eslint": "^8.39.0",
|
|
63
|
+
"eslint-config-prettier": "^8.8.0",
|
|
64
|
+
"eslint-plugin-import": "^2.27.5",
|
|
65
|
+
"husky": "^8.0.3",
|
|
66
|
+
"jest": "^29.5.0",
|
|
62
67
|
"less": "^4.1.3",
|
|
63
68
|
"less-plugin-glob": "^2.0.2",
|
|
64
|
-
"lint-staged": "^
|
|
65
|
-
"memfs": "^3.
|
|
69
|
+
"lint-staged": "^13.2.2",
|
|
70
|
+
"memfs": "^3.5.1",
|
|
66
71
|
"npm-run-all": "^4.1.5",
|
|
67
|
-
"prettier": "^2.
|
|
72
|
+
"prettier": "^2.8.8",
|
|
68
73
|
"standard-version": "^9.3.1",
|
|
69
74
|
"strip-ansi": "^7.0.0",
|
|
70
|
-
"webpack": "^5.
|
|
75
|
+
"webpack": "^5.81.0"
|
|
71
76
|
},
|
|
72
77
|
"keywords": [
|
|
73
78
|
"webpack",
|
package/dist/LessError.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
class LessError extends Error {
|
|
13
|
-
constructor(error) {
|
|
14
|
-
super();
|
|
15
|
-
this.message = ["\n", ...LessError.getFileExcerptIfPossible(error), error.message.charAt(0).toUpperCase() + error.message.slice(1), error.filename ? ` Error in ${_path.default.normalize(error.filename)} (line ${error.line}, column ${error.column})` : ""].join("\n");
|
|
16
|
-
this.hideStack = true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static getFileExcerptIfPossible(lessError) {
|
|
20
|
-
if (typeof lessError.extract === "undefined") {
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const excerpt = lessError.extract.slice(0, 2);
|
|
25
|
-
const column = Math.max(lessError.column - 1, 0);
|
|
26
|
-
|
|
27
|
-
if (typeof excerpt[0] === "undefined") {
|
|
28
|
-
excerpt.shift();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
excerpt.push(`${new Array(column).join(" ")}^`);
|
|
32
|
-
return excerpt;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var _default = LessError;
|
|
38
|
-
exports.default = _default;
|