less-loader 11.1.2 → 11.1.4

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.
Files changed (2) hide show
  1. package/dist/utils.js +8 -6
  2. package/package.json +16 -19
package/dist/utils.js CHANGED
@@ -9,7 +9,6 @@ exports.getLessOptions = getLessOptions;
9
9
  exports.isUnsupportedUrl = isUnsupportedUrl;
10
10
  exports.normalizeSourceMap = normalizeSourceMap;
11
11
  var _path = _interopRequireDefault(require("path"));
12
- var _full = require("klona/full");
13
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
13
  /* eslint-disable class-methods-use-this */
15
14
  const trailingSlash = /[/\\]$/;
@@ -119,7 +118,8 @@ function createWebpackLessPlugin(loaderContext, implementation) {
119
118
  loaderContext.addDependency(result);
120
119
  return super.loadFile(result, ...args);
121
120
  }
122
- loaderContext.addDependency(_path.default.normalize(result.filename));
121
+ const absoluteFilename = _path.default.isAbsolute(result.filename) ? result.filename : _path.default.resolve(".", result.filename);
122
+ loaderContext.addDependency(_path.default.normalize(absoluteFilename));
123
123
  return result;
124
124
  }
125
125
  }
@@ -132,7 +132,7 @@ function createWebpackLessPlugin(loaderContext, implementation) {
132
132
  }
133
133
 
134
134
  /**
135
- * Get the less options from the loader context and normalizes its values
135
+ * Get the `less` options from the loader context and normalizes its values
136
136
  *
137
137
  * @param {object} loaderContext
138
138
  * @param {object} loaderOptions
@@ -140,7 +140,7 @@ function createWebpackLessPlugin(loaderContext, implementation) {
140
140
  * @returns {Object}
141
141
  */
142
142
  function getLessOptions(loaderContext, loaderOptions, implementation) {
143
- const options = (0, _full.klona)(typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {});
143
+ const options = typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {};
144
144
  const lessOptions = {
145
145
  plugins: [],
146
146
  relativeUrls: true,
@@ -148,17 +148,19 @@ function getLessOptions(loaderContext, loaderOptions, implementation) {
148
148
  filename: loaderContext.resourcePath,
149
149
  ...options
150
150
  };
151
+ const plugins = lessOptions.plugins.slice();
151
152
  const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" ? loaderOptions.webpackImporter : true;
152
153
  if (shouldUseWebpackImporter) {
153
- lessOptions.plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
154
+ plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
154
155
  }
155
- lessOptions.plugins.unshift({
156
+ plugins.unshift({
156
157
  install(lessProcessor, pluginManager) {
157
158
  // eslint-disable-next-line no-param-reassign
158
159
  pluginManager.webpackLoaderContext = loaderContext;
159
160
  lessOptions.pluginManager = pluginManager;
160
161
  }
161
162
  });
163
+ lessOptions.plugins = plugins;
162
164
  return lessOptions;
163
165
  }
164
166
  function isUnsupportedUrl(url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "less-loader",
3
- "version": "11.1.2",
3
+ "version": "11.1.4",
4
4
  "description": "A Less loader for webpack. Compiles Less to CSS.",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/less-loader",
@@ -44,35 +44,32 @@
44
44
  "less": "^3.5.0 || ^4.0.0",
45
45
  "webpack": "^5.0.0"
46
46
  },
47
- "dependencies": {
48
- "klona": "^2.0.6"
49
- },
50
47
  "devDependencies": {
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",
48
+ "@babel/cli": "^7.23.0",
49
+ "@babel/core": "^7.23.0",
50
+ "@babel/preset-env": "^7.22.20",
51
+ "@commitlint/cli": "^17.7.2",
52
+ "@commitlint/config-conventional": "^17.7.0",
56
53
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
57
- "babel-jest": "^29.5.0",
54
+ "babel-jest": "^29.7.0",
58
55
  "cross-env": "^7.0.3",
59
- "cspell": "^6.31.1",
56
+ "cspell": "^6.31.2",
60
57
  "del": "^6.1.1",
61
58
  "del-cli": "^4.0.1",
62
- "eslint": "^8.39.0",
63
- "eslint-config-prettier": "^8.8.0",
64
- "eslint-plugin-import": "^2.27.5",
59
+ "eslint": "^8.50.0",
60
+ "eslint-config-prettier": "^8.9.0",
61
+ "eslint-plugin-import": "^2.28.1",
65
62
  "husky": "^8.0.3",
66
- "jest": "^29.5.0",
67
- "less": "^4.1.3",
63
+ "jest": "^29.7.0",
64
+ "less": "^4.2.0",
68
65
  "less-plugin-glob": "^2.0.2",
69
- "lint-staged": "^13.2.2",
66
+ "lint-staged": "^13.2.3",
70
67
  "memfs": "^3.5.1",
71
68
  "npm-run-all": "^4.1.5",
72
69
  "prettier": "^2.8.8",
73
70
  "standard-version": "^9.3.1",
74
- "strip-ansi": "^7.0.0",
75
- "webpack": "^5.81.0"
71
+ "strip-ansi": "^7.1.0",
72
+ "webpack": "^5.88.2"
76
73
  },
77
74
  "keywords": [
78
75
  "webpack",