less-loader 12.3.2 → 13.0.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.
@@ -0,0 +1,67 @@
1
+ {
2
+ "title": "Less Loader options",
3
+ "type": "object",
4
+ "properties": {
5
+ "lessOptions": {
6
+ "description": "Options to pass through to `Less`.",
7
+ "link": "https://github.com/webpack/less-loader#lessoptions",
8
+ "anyOf": [
9
+ {
10
+ "type": "object",
11
+ "additionalProperties": true
12
+ },
13
+ {
14
+ "instanceof": "Function"
15
+ }
16
+ ]
17
+ },
18
+ "additionalData": {
19
+ "description": "Prepends/Appends `Less` code to the actual entry file.",
20
+ "link": "https://github.com/webpack/less-loader#additionalData",
21
+ "anyOf": [
22
+ {
23
+ "type": "string"
24
+ },
25
+ {
26
+ "instanceof": "Function"
27
+ }
28
+ ]
29
+ },
30
+ "sourceMap": {
31
+ "description": "Enables/Disables generation of source maps.",
32
+ "link": "https://github.com/webpack/less-loader#sourcemap",
33
+ "type": "boolean"
34
+ },
35
+ "webpackImporter": {
36
+ "description": "Enables/Disables default `webpack` importer.",
37
+ "link": "https://github.com/webpack/less-loader#webpackimporter",
38
+ "anyOf": [
39
+ {
40
+ "type": "boolean"
41
+ },
42
+ {
43
+ "type": "string",
44
+ "enum": ["only"]
45
+ }
46
+ ]
47
+ },
48
+ "implementation": {
49
+ "description": "The implementation of the `Less` to be used.",
50
+ "link": "https://github.com/webpack/less-loader#implementation",
51
+ "anyOf": [
52
+ {
53
+ "type": "string"
54
+ },
55
+ {
56
+ "type": "object"
57
+ }
58
+ ]
59
+ },
60
+ "lessLogAsWarnOrErr": {
61
+ "description": "Less warnings and errors will be webpack warnings or errors.",
62
+ "link": "https://github.com/webpack/less-loader#lesslogaswarnorerr",
63
+ "type": "boolean"
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ }
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,378 @@
1
+ import path from "node:path";
2
+ import url from "node:url";
3
+
4
+ /** @typedef {import("webpack").LoaderContext<LoaderOptions>} LoaderContext */
5
+ /** @typedef {import("less")} Less */
6
+
7
+ /** @typedef {Parameters<Less["render"]>[1]} LessOptions */
8
+ /** @typedef {NonNullable<LessOptions["plugins"]>[number]} LessPlugin */
9
+ /** @typedef {Less["FileManager"]} LessFileManager */
10
+ /** @typedef {InstanceType<Less["PluginManager"]>} PluginManager */
11
+ /** @typedef {InstanceType<LessFileManager>} LessFileManagerInstance */
12
+ /** @typedef {Parameters<InstanceType<LessFileManager>["loadFile"]>[2]} LoadFileOptions */
13
+ /** @typedef {Parameters<InstanceType<LessFileManager>["loadFile"]>[3]} Environment */
14
+ /** @typedef {Awaited<ReturnType<LessFileManagerInstance["loadFile"]>>} LoadFileResult */
15
+
16
+ /**
17
+ * @typedef {object} LoaderOptions
18
+ * @property {LessOptions | ((loaderContext: LoaderContext) => LessOptions)=} lessOptions less options
19
+ * @property {string | ((source: string, loaderContext: LoaderContext) => string | Promise<string>)=} additionalData additional data
20
+ * @property {boolean=} sourceMap true when need to generate source map, otherwise false
21
+ * @property {boolean | "only"=} webpackImporter true when need to use webpack importer, otherwise false
22
+ * @property {string | Less=} implementation implementation
23
+ * @property {boolean=} lessLogAsWarnOrErr true when need to log less warnings and errors as webpack warnings and errors
24
+ */
25
+
26
+ /**
27
+ * @typedef {object} SourceMap
28
+ * @property {string=} file file
29
+ * @property {string=} sourceRoot source root
30
+ * @property {string[]} sources sources
31
+ */
32
+
33
+ /**
34
+ * @typedef {Error & { type?: string, filename?: string, line?: number, column?: number, extract?: string[] }} LessError
35
+ */
36
+
37
+ const trailingSlash = /[/\\]$/;
38
+
39
+ // This somewhat changed in Less 3.x. Now the file name comes without the
40
+ // automatically added extension whereas the extension is passed in as `options.ext`.
41
+ // So, if the file name matches this regexp, we simply ignore the proposed extension.
42
+ const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/;
43
+
44
+ // `[drive_letter]:\` + `\\[server]\[share_name]\`
45
+ const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
46
+
47
+ // Examples:
48
+ // - ~package
49
+ // - ~package/
50
+ // - ~@org
51
+ // - ~@org/
52
+ // - ~@org/package
53
+ // - ~@org/package/
54
+ const IS_MODULE_IMPORT = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
55
+ const MODULE_REQUEST_REGEX = /^[^?]*~/;
56
+
57
+ /**
58
+ * Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.
59
+ * @param {LoaderContext} loaderContext loader context
60
+ * @param {Less} implementation implementation
61
+ * @param {Promise<void>[]} pendingDependencyTasks pending dependency tasks
62
+ * @returns {LessPlugin} less plugin
63
+ */
64
+ function createWebpackLessPlugin(loaderContext, implementation, pendingDependencyTasks) {
65
+ const lessOptions = /** @type {LoaderOptions} */
66
+ loaderContext.getOptions();
67
+ const resolve = loaderContext.getResolve({
68
+ dependencyType: "less",
69
+ conditionNames: ["less", "style", "..."],
70
+ mainFields: ["less", "style", "main", "..."],
71
+ mainFiles: ["index", "..."],
72
+ extensions: [".less", ".css"],
73
+ preferRelative: true
74
+ });
75
+ class WebpackFileManager extends implementation.FileManager {
76
+ /**
77
+ * @param {string} filename filename
78
+ * @returns {boolean} true when filename is supported, otherwise false
79
+ */
80
+ supports(filename) {
81
+ if (filename[0] === "/" || IS_NATIVE_WIN32_PATH.test(filename)) {
82
+ return true;
83
+ }
84
+ if (this.isPathAbsolute(filename)) {
85
+ return false;
86
+ }
87
+ return true;
88
+ }
89
+
90
+ // Sync loading is used by `data-uri()` and any custom Less function
91
+ // (including those installed via `@plugin`). Webpack doesn't expose a
92
+ // sync resolver, so we fulfil the sync read by delegating to Less's
93
+ // default file manager (which can only handle native filesystem paths)
94
+ // and, in parallel, kick off an async webpack resolve so the loaded
95
+ // file is tracked as a webpack file dependency. Without this, webpack's
96
+ // persistent cache won't invalidate when a sync-loaded file changes.
97
+ // See https://github.com/webpack/less-loader/issues/492.
98
+ /**
99
+ * @returns {boolean} true when support sync, otherwise false
100
+ */
101
+ supportsSync() {
102
+ return true;
103
+ }
104
+
105
+ /**
106
+ * @param {string} filename filename
107
+ * @param {string} currentDirectory current directory
108
+ * @param {LoadFileOptions} options options
109
+ * @param {Environment} environment environment
110
+ * @returns {LoadFileResult} loaded file
111
+ */
112
+ loadFileSync(filename, currentDirectory, options, environment) {
113
+ // The default Less `loadFileSync` internally dispatches to
114
+ // `this.loadFile` with `options.syncImport = true`. Because we
115
+ // override `loadFile` (async), dynamic dispatch would land back in
116
+ // our async version and break the sync contract. Invoke the parent
117
+ // `loadFile` directly with the sync flag instead.
118
+ // @ts-expect-error bad types in less
119
+ const result = /** @type {LoadFileResult} */
120
+ super.loadFile(filename, currentDirectory, {
121
+ ...options,
122
+ syncImport: true
123
+ }, environment);
124
+ if (result && result.filename) {
125
+ loaderContext.addDependency(path.normalize(path.isAbsolute(result.filename) ? result.filename : path.resolve(currentDirectory || ".", result.filename)));
126
+ }
127
+
128
+ // Also try to resolve via webpack so aliases / custom resolvers can
129
+ // contribute dependencies. The resolved content is discarded - we
130
+ // only need the file path to track as a dependency.
131
+ pendingDependencyTasks.push(this.resolveFilename(filename, currentDirectory).then(resolved => {
132
+ const absoluteFilename = path.isAbsolute(resolved) ? resolved : path.resolve(".", resolved);
133
+ loaderContext.addDependency(path.normalize(absoluteFilename));
134
+ }).catch(() => {
135
+ // Webpack may legitimately fail to resolve paths that Less's
136
+ // default sync manager handled (e.g. node-style relative
137
+ // lookups). The sync result above is what Less consumes, so
138
+ // ignore the async failure.
139
+ }));
140
+ return result;
141
+ }
142
+
143
+ /**
144
+ * @param {string} filename filename
145
+ * @param {string} currentDirectory current directory
146
+ * @returns {Promise<string>} resolved filename
147
+ */
148
+ async resolveFilename(filename, currentDirectory) {
149
+ // Less is giving us trailing slashes, but the context should have no trailing slash
150
+ const context = currentDirectory.replace(trailingSlash, "");
151
+ let request = filename;
152
+
153
+ // A `~` makes the url an module
154
+ if (MODULE_REQUEST_REGEX.test(filename)) {
155
+ request = request.replace(MODULE_REQUEST_REGEX, "");
156
+ }
157
+ if (IS_MODULE_IMPORT.test(filename)) {
158
+ request = request[request.length - 1] === "/" ? request : `${request}/`;
159
+ }
160
+ return this.resolveRequests(context, [...new Set([request, filename])]);
161
+ }
162
+
163
+ /**
164
+ * @param {string} context context
165
+ * @param {string[]} possibleRequests possible requests
166
+ * @returns {Promise<string>} resolved requests
167
+ */
168
+ async resolveRequests(context, possibleRequests) {
169
+ if (possibleRequests.length === 0) {
170
+ throw new Error("No possible requests to resolve");
171
+ }
172
+ let result;
173
+ try {
174
+ result = await resolve(context, possibleRequests[0]);
175
+ } catch (error) {
176
+ const [, ...tailPossibleRequests] = possibleRequests;
177
+ if (tailPossibleRequests.length === 0) {
178
+ throw error;
179
+ }
180
+ result = await this.resolveRequests(context, tailPossibleRequests);
181
+ }
182
+ return result;
183
+ }
184
+
185
+ /**
186
+ * @param {string} filename filename
187
+ * @param {string} currentDirectory current directory
188
+ * @param {LoadFileOptions} options options
189
+ * @param {Environment} environment environment
190
+ * @returns {Promise<LoadFileResult>} loaded file
191
+ */
192
+ async loadFile(filename, currentDirectory, options, environment) {
193
+ let result;
194
+ try {
195
+ if (IS_SPECIAL_MODULE_IMPORT.test(filename) || lessOptions.webpackImporter === "only") {
196
+ const error = /** @type {LessError} */new Error("Next");
197
+ error.type = "Next";
198
+ throw error;
199
+ }
200
+ result = await super.loadFile(filename, currentDirectory, options, environment);
201
+ } catch (error) {
202
+ const lessError = /** @type {LessError} */error;
203
+ if (lessError.type !== "File" && lessError.type !== "Next") {
204
+ throw error;
205
+ }
206
+ try {
207
+ result = await this.resolveFilename(filename, currentDirectory);
208
+ } catch (err) {
209
+ lessError.message = `Less resolver error:\n${lessError.message}\n\n` + `Webpack resolver error details:\n${ /** @type {{ details: string }} */err.details}\n\n` + `Webpack resolver error missing:\n${ /** @type {{ missing: string }} */err.missing}\n\n`;
210
+ throw error;
211
+ }
212
+ loaderContext.addDependency(result);
213
+ return super.loadFile(result, currentDirectory, options, environment);
214
+ }
215
+ const absoluteFilename = path.isAbsolute(result.filename) ? result.filename : path.resolve(".", result.filename);
216
+ loaderContext.addDependency(path.normalize(absoluteFilename));
217
+ return result;
218
+ }
219
+ }
220
+ return {
221
+ /**
222
+ * @param {Less} less less
223
+ * @param {PluginManager} pluginManager plugin manager
224
+ */
225
+ install(less, pluginManager) {
226
+ pluginManager.addFileManager(new WebpackFileManager());
227
+ },
228
+ minVersion: [3, 0, 0]
229
+ };
230
+ }
231
+
232
+ /**
233
+ * Get the `less` options from the loader context and normalizes its values
234
+ * @param {LoaderContext} loaderContext loader context
235
+ * @param {LoaderOptions} loaderOptions loader options
236
+ * @param {Less} implementation implementation
237
+ * @returns {{ lessOptions: LessOptions, pendingDependencyTasks: Promise<void>[] }} implementation and pending tasks
238
+ */
239
+ function getLessOptions(loaderContext, loaderOptions, implementation) {
240
+ const options = typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {};
241
+
242
+ /** @type {LessOptions} */
243
+ const lessOptions = {
244
+ // @ts-expect-error bad types
245
+ relativeUrls: true,
246
+ // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
247
+ filename: loaderContext.resourcePath,
248
+ ...options
249
+ };
250
+
251
+ // Collects async dependency-resolution promises kicked off from
252
+ // synchronous Less file loads (e.g. `data-uri()`, `@plugin`). The loader
253
+ // awaits these before completing so webpack's dependency snapshot is
254
+ // accurate.
255
+ /** @type {Promise<void>[]} */
256
+ const pendingDependencyTasks = [];
257
+
258
+ /** @type {LessPlugin[]} */
259
+ const plugins = [...(lessOptions.plugins || [])];
260
+ const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" || loaderOptions.webpackImporter === "only" ? loaderOptions.webpackImporter : true;
261
+ if (shouldUseWebpackImporter) {
262
+ plugins.unshift(createWebpackLessPlugin(loaderContext, implementation, pendingDependencyTasks));
263
+ }
264
+ plugins.unshift({
265
+ /**
266
+ * @param {Less} less less
267
+ * @param {PluginManager} pluginManager plugin manager
268
+ */
269
+ install(less, pluginManager) {
270
+ // @ts-expect-error to provide loader context into plugin
271
+ pluginManager.webpackLoaderContext = loaderContext;
272
+ // @ts-expect-error to reset it after execution
273
+ lessOptions.pluginManager = pluginManager;
274
+ }
275
+ });
276
+ lessOptions.plugins = plugins;
277
+ return {
278
+ lessOptions,
279
+ pendingDependencyTasks
280
+ };
281
+ }
282
+
283
+ /**
284
+ * @param {string} url url
285
+ * @returns {boolean} true when url is unsupported, otherwise false
286
+ */
287
+ function isUnsupportedUrl(url) {
288
+ // Is Windows path
289
+ if (IS_NATIVE_WIN32_PATH.test(url)) {
290
+ return false;
291
+ }
292
+
293
+ // Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
294
+ // Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
295
+ return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
296
+ }
297
+
298
+ /**
299
+ * @param {SourceMap} map map
300
+ * @returns {SourceMap} normalized source map
301
+ */
302
+ function normalizeSourceMap(map) {
303
+ const newMap = map;
304
+
305
+ // map.file is an optional property that provides the output filename.
306
+ // Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
307
+
308
+ delete newMap.file;
309
+ newMap.sourceRoot = "";
310
+
311
+ // `less` returns POSIX paths, that's why we need to transform them back to native paths.
312
+
313
+ newMap.sources = newMap.sources.map(source => path.normalize(source));
314
+ return newMap;
315
+ }
316
+
317
+ /**
318
+ * @param {string} specifier specifier
319
+ * @returns {string} resolved specifier
320
+ */
321
+ function normalizeImportSpecifier(specifier) {
322
+ if (specifier.startsWith("file:")) {
323
+ return specifier;
324
+ }
325
+ if (path.isAbsolute(specifier)) {
326
+ return url.pathToFileURL(specifier).href;
327
+ }
328
+ return specifier;
329
+ }
330
+
331
+ /**
332
+ * @param {LoaderContext} loaderContext loader context
333
+ * @param {string | Less | undefined} implementation implementation
334
+ * @returns {Promise<Less>} less implementation
335
+ */
336
+ async function getLessImplementation(loaderContext, implementation) {
337
+ let resolvedImplementation = implementation;
338
+ if (!implementation || typeof implementation === "string") {
339
+ const lessImplPkg = implementation || "less";
340
+ const imported = await import(normalizeImportSpecifier(lessImplPkg));
341
+ resolvedImplementation = imported.default ?? imported;
342
+ }
343
+ return /** @type {Less} */resolvedImplementation;
344
+ }
345
+
346
+ /**
347
+ * @param {LessError} error error
348
+ * @returns {string[]} file excerpt
349
+ */
350
+ function getFileExcerptIfPossible(error) {
351
+ if (typeof error.extract === "undefined") {
352
+ return [];
353
+ }
354
+ const excerpt = error.extract.slice(0, 2);
355
+ const column = Math.max(/** @type {number} */error.column - 1, 0);
356
+ if (typeof excerpt[0] === "undefined") {
357
+ excerpt.shift();
358
+ }
359
+ excerpt.push(`${" ".repeat(column)}^`);
360
+ return excerpt;
361
+ }
362
+
363
+ /**
364
+ * @param {LessError} error error
365
+ * @returns {Error} built error
366
+ */
367
+ function errorFactory(error) {
368
+ const message = ["\n", ...getFileExcerptIfPossible(error), error.message.charAt(0).toUpperCase() + error.message.slice(1), error.filename ? ` Error in ${path.normalize(error.filename)} (line ${error.line}, column ${error.column})` : ""].join("\n");
369
+ const obj = /** @type {Error & { stack: string | null }} */
370
+ new Error(message, {
371
+ cause: error
372
+ });
373
+
374
+ // @ts-expect-error avoid extra stack for less
375
+ obj.stack = null;
376
+ return obj;
377
+ }
378
+ export { errorFactory, getLessImplementation, getLessOptions, isUnsupportedUrl, normalizeSourceMap };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "less-loader",
3
- "version": "12.3.2",
3
+ "version": "13.0.0",
4
4
  "description": "A Less loader for webpack. Compiles Less to CSS.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -20,56 +20,72 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "author": "Johannes Ewald @jhnns",
23
- "main": "dist/cjs.js",
23
+ "type": "module",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./types/index.d.ts",
27
+ "import": "./dist/esm/index.js",
28
+ "require": "./dist/cjs/index.js",
29
+ "default": "./dist/esm/index.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "main": "./dist/cjs/index.js",
34
+ "module": "./dist/esm/index.js",
35
+ "types": "./types/index.d.ts",
24
36
  "files": [
25
- "dist"
37
+ "dist",
38
+ "types"
26
39
  ],
27
40
  "scripts": {
28
41
  "start": "npm run build -- -w",
29
42
  "clean": "del-cli dist",
30
43
  "prebuild": "npm run clean",
31
- "build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
32
- "commitlint": "commitlint --from=main",
44
+ "build:esm": "babel src -d dist/esm --env-name esm --copy-files --no-copy-ignored && node -e \"require('fs').writeFileSync('dist/esm/package.json','{\\\"type\\\":\\\"module\\\"}\\n')\"",
45
+ "build:cjs": "babel src -d dist/cjs --env-name cjs --copy-files --no-copy-ignored && node -e \"const fs=require('fs');fs.writeFileSync('dist/cjs/package.json','{\\\"type\\\":\\\"commonjs\\\"}\\n');fs.appendFileSync('dist/cjs/index.js','module.exports = exports.default;\\nmodule.exports.default = exports.default;\\n')\"",
46
+ "build:types": "tsc && prettier \"types/**/*.ts\" --write",
47
+ "build": "npm-run-all -p \"build:*\"",
33
48
  "security": "npm audit --production",
34
- "lint:prettier": "prettier --cache --list-different .",
35
- "lint:js": "eslint --cache .",
49
+ "lint": "npm-run-all -l -p \"lint:**\" && npm run fmt:check",
50
+ "lint:code": "eslint --cache .",
36
51
  "lint:spelling": "cspell --cache --no-must-find-files --quiet \"**/*.*\"",
37
- "lint": "npm-run-all -l -p \"lint:**\"",
38
- "fix:js": "npm run lint:js -- --fix",
39
- "fix:prettier": "npm run lint:prettier -- --write",
40
- "fix": "npm-run-all -l fix:js fix:prettier",
41
- "test:only": "node --experimental-vm-modules node_modules/jest-cli/bin/jest.js",
42
- "test:watch": "npm run test:only -- --watch",
43
- "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
52
+ "lint:types": "tsc --pretty --noEmit",
53
+ "fmt": "npm run fmt:check -- --write",
54
+ "fmt:check": "prettier --list-different --cache --ignore-unknown .",
55
+ "fix": "npm run fix:code && npm run fmt",
56
+ "fix:code": "npm run lint:code -- --fix",
44
57
  "pretest": "npm run lint",
45
- "test": "npm run test:coverage",
58
+ "test": "npm run test:base",
59
+ "test:base": "node --import ./test/setup-snapshots.js --test --test-force-exit --test-reporter=dot --test-reporter-destination=stdout --experimental-test-module-mocks",
60
+ "test:coverage": "npm run test:base -- --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=coverage.lcov --test-coverage-include=\"src/**/*.js\"",
46
61
  "prepare": "husky && npm run build",
47
- "release": "standard-version"
62
+ "version": "changeset version",
63
+ "release": "npm run build && changeset publish"
64
+ },
65
+ "dependencies": {
66
+ "@types/less": "^3.0.8"
48
67
  },
49
68
  "devDependencies": {
50
69
  "@babel/cli": "^7.24.7",
51
70
  "@babel/core": "^7.24.7",
52
- "@babel/preset-env": "^7.24.7",
53
- "@commitlint/cli": "^18.6.1",
54
- "@commitlint/config-conventional": "^18.6.2",
55
- "babel-jest": "^30.0.0",
56
- "cross-env": "^7.0.3",
57
- "cspell": "^8.10.0",
58
- "del": "^7.1.0",
59
- "del-cli": "^5.1.0",
71
+ "@babel/preset-env": "^7.29.5",
72
+ "@changesets/cli": "^2.30.0",
73
+ "@changesets/get-github-info": "^0.8.0",
74
+ "@types/node": "^22.13.4",
75
+ "cspell": "^10.0.0",
76
+ "del": "^8.0.1",
77
+ "del-cli": "^7.0.0",
60
78
  "eslint": "^9.32.0",
61
- "eslint-config-webpack": "^4.5.1",
79
+ "eslint-config-webpack": "^4.9.6",
62
80
  "husky": "^9.1.3",
63
- "jest": "^30.0.0",
64
- "less": "^4.6.2",
81
+ "less": "^4.6.4",
65
82
  "less-plugin-glob": "^3.0.0",
66
- "lint-staged": "^15.2.7",
67
- "memfs": "^4.9.3",
83
+ "lint-staged": "^17.0.5",
84
+ "memfs": "^4.57.2",
68
85
  "npm-run-all": "^4.1.5",
69
- "prettier": "^3.3.2",
70
- "standard-version": "^9.3.1",
71
- "strip-ansi": "^7.1.0",
72
- "webpack": "^5.92.1"
86
+ "prettier": "^3.8.3",
87
+ "typescript": "^6.0.3",
88
+ "webpack": "^5.107.0"
73
89
  },
74
90
  "peerDependencies": {
75
91
  "@rspack/core": "0.x || ^1.0.0 || ^2.0.0-0",
@@ -85,6 +101,6 @@
85
101
  }
86
102
  },
87
103
  "engines": {
88
- "node": ">= 18.12.0"
104
+ "node": ">= 22.11.0"
89
105
  }
90
106
  }
@@ -0,0 +1,21 @@
1
+ export default lessLoader;
2
+ export type LoaderContext = import("webpack").LoaderContext<LoaderOptions>;
3
+ export type Schema = import("schema-utils/declarations/validate").Schema;
4
+ export type LoaderOptions = import("./utils.js").LoaderOptions;
5
+ export type LessError = import("./utils.js").LessError;
6
+ export type SourceMap = import("./utils.js").SourceMap;
7
+ /** @typedef {import("webpack").LoaderContext<LoaderOptions>} LoaderContext */
8
+ /** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
9
+ /** @typedef {import("./utils.js").LoaderOptions} LoaderOptions */
10
+ /** @typedef {import("./utils.js").LessError} LessError */
11
+ /** @typedef {import("./utils.js").SourceMap} SourceMap */
12
+ /**
13
+ * Webpack loader that compiles Less to CSS.
14
+ * @this {LoaderContext}
15
+ * @param {string} content content
16
+ * @returns {Promise<void>} loader result
17
+ */
18
+ declare function lessLoader(
19
+ this: import("webpack").LoaderContext<import("./utils.js").LoaderOptions>,
20
+ content: string,
21
+ ): Promise<void>;