@rsbuild/core 0.7.0-beta.5 → 0.7.0-beta.7

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 (35) hide show
  1. package/compiled/commander/index.d.ts +110 -40
  2. package/compiled/commander/index.js +561 -284
  3. package/compiled/commander/package.json +1 -1
  4. package/compiled/css-loader/index.js +20 -20
  5. package/compiled/postcss-load-config/index.js +4 -224
  6. package/compiled/postcss-loader/index.js +11 -11
  7. package/compiled/rspack-manifest-plugin/index.js +4 -4
  8. package/dist/index.cjs +284 -509
  9. package/dist/index.js +129 -372
  10. package/dist-types/constants.d.ts +3 -0
  11. package/dist-types/index.d.ts +1 -1
  12. package/dist-types/plugins/index.d.ts +0 -2
  13. package/dist-types/provider/createCompiler.d.ts +30 -4
  14. package/dist-types/server/compilerDevMiddleware.d.ts +2 -1
  15. package/dist-types/server/devMiddleware.d.ts +15 -1
  16. package/dist-types/server/devServer.d.ts +4 -3
  17. package/dist-types/server/getDevMiddlewares.d.ts +9 -2
  18. package/dist-types/server/helper.d.ts +6 -18
  19. package/dist-types/server/middlewares.d.ts +2 -2
  20. package/dist-types/server/prodServer.d.ts +3 -3
  21. package/dist-types/server/watchFiles.d.ts +2 -1
  22. package/dist-types/types.d.ts +9 -0
  23. package/package.json +4 -6
  24. package/compiled/less-loader/index.d.ts +0 -1
  25. package/compiled/less-loader/index.js +0 -414
  26. package/compiled/less-loader/license +0 -20
  27. package/compiled/less-loader/package.json +0 -1
  28. package/compiled/postcss-load-config/292.index.js +0 -2533
  29. package/compiled/postcss-load-config/344.index.js +0 -21
  30. package/compiled/resolve-url-loader/index.d.ts +0 -1
  31. package/compiled/resolve-url-loader/index.js +0 -5719
  32. package/compiled/resolve-url-loader/license +0 -21
  33. package/compiled/resolve-url-loader/package.json +0 -1
  34. package/dist-types/plugins/less.d.ts +0 -2
  35. package/dist-types/plugins/sass.d.ts +0 -18
@@ -1,414 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ var __webpack_modules__ = ({
4
-
5
- /***/ 949:
6
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
7
-
8
-
9
-
10
- module.exports = __nccwpck_require__(323)["default"];
11
-
12
- /***/ }),
13
-
14
- /***/ 323:
15
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
16
-
17
- var __webpack_unused_export__;
18
-
19
-
20
- __webpack_unused_export__ = ({
21
- value: true
22
- });
23
- exports["default"] = void 0;
24
- var _path = _interopRequireDefault(__nccwpck_require__(17));
25
- var _options = _interopRequireDefault(__nccwpck_require__(649));
26
- var _utils = __nccwpck_require__(637);
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- async function lessLoader(source) {
29
- const options = this.getOptions(_options.default);
30
- const callback = this.async();
31
- let implementation;
32
- try {
33
- implementation = (0, _utils.getLessImplementation)(this, options.implementation);
34
- } catch (error) {
35
- callback(error);
36
- return;
37
- }
38
- if (!implementation) {
39
- callback(new Error(`The Less implementation "${options.implementation}" not found`));
40
- return;
41
- }
42
- const lessOptions = (0, _utils.getLessOptions)(this, options, implementation);
43
- const useSourceMap = typeof options.sourceMap === "boolean" ? options.sourceMap : this.sourceMap;
44
- if (useSourceMap) {
45
- lessOptions.sourceMap = {
46
- outputSourceFiles: true
47
- };
48
- }
49
- let data = source;
50
- if (typeof options.additionalData !== "undefined") {
51
- data = typeof options.additionalData === "function" ? `${await options.additionalData(data, this)}` : `${options.additionalData}\n${data}`;
52
- }
53
- const logger = this.getLogger("less-loader");
54
- const loaderContext = this;
55
- const loggerListener = {
56
- error(message) {
57
- // TODO enable by default in the next major release
58
- if (options.lessLogAsWarnOrErr) {
59
- loaderContext.emitError(new Error(message));
60
- } else {
61
- logger.error(message);
62
- }
63
- },
64
- warn(message) {
65
- // TODO enable by default in the next major release
66
- if (options.lessLogAsWarnOrErr) {
67
- loaderContext.emitWarning(new Error(message));
68
- } else {
69
- logger.warn(message);
70
- }
71
- },
72
- info(message) {
73
- logger.log(message);
74
- },
75
- debug(message) {
76
- logger.debug(message);
77
- }
78
- };
79
- implementation.logger.addListener(loggerListener);
80
- let result;
81
- try {
82
- result = await implementation.render(data, lessOptions);
83
- } catch (error) {
84
- if (error.filename) {
85
- // `less` returns forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
86
- // Ref: https://github.com/webpack-contrib/less-loader/issues/357
87
- this.addDependency(_path.default.normalize(error.filename));
88
- }
89
- callback((0, _utils.errorFactory)(error));
90
- return;
91
- } finally {
92
- // Fix memory leaks in `less`
93
- implementation.logger.removeListener(loggerListener);
94
- delete lessOptions.pluginManager.webpackLoaderContext;
95
- delete lessOptions.pluginManager;
96
- }
97
- const {
98
- css,
99
- imports
100
- } = result;
101
- imports.forEach(item => {
102
- if ((0, _utils.isUnsupportedUrl)(item)) {
103
- return;
104
- }
105
-
106
- // `less` return forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
107
- // Ref: https://github.com/webpack-contrib/less-loader/issues/357
108
- const normalizedItem = _path.default.normalize(item);
109
-
110
- // Custom `importer` can return only `contents` so item will be relative
111
- if (_path.default.isAbsolute(normalizedItem)) {
112
- this.addDependency(normalizedItem);
113
- }
114
- });
115
- let map = typeof result.map === "string" ? JSON.parse(result.map) : result.map;
116
- if (map && useSourceMap) {
117
- map = (0, _utils.normalizeSourceMap)(map, this.rootContext);
118
- }
119
- callback(null, css, map);
120
- }
121
- var _default = exports["default"] = lessLoader;
122
-
123
- /***/ }),
124
-
125
- /***/ 637:
126
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
127
-
128
-
129
-
130
- Object.defineProperty(exports, "__esModule", ({
131
- value: true
132
- }));
133
- exports.errorFactory = errorFactory;
134
- exports.getLessImplementation = getLessImplementation;
135
- exports.getLessOptions = getLessOptions;
136
- exports.isUnsupportedUrl = isUnsupportedUrl;
137
- exports.normalizeSourceMap = normalizeSourceMap;
138
- var _path = _interopRequireDefault(__nccwpck_require__(17));
139
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
140
- /* eslint-disable class-methods-use-this */
141
- const trailingSlash = /[/\\]$/;
142
-
143
- // This somewhat changed in Less 3.x. Now the file name comes without the
144
- // automatically added extension whereas the extension is passed in as `options.ext`.
145
- // So, if the file name matches this regexp, we simply ignore the proposed extension.
146
- const IS_SPECIAL_MODULE_IMPORT = /^~[^/]+$/;
147
-
148
- // `[drive_letter]:\` + `\\[server]\[share_name]\`
149
- const IS_NATIVE_WIN32_PATH = /^[a-z]:[/\\]|^\\\\/i;
150
-
151
- // Examples:
152
- // - ~package
153
- // - ~package/
154
- // - ~@org
155
- // - ~@org/
156
- // - ~@org/package
157
- // - ~@org/package/
158
- const IS_MODULE_IMPORT = /^~([^/]+|[^/]+\/|@[^/]+[/][^/]+|@[^/]+\/?|@[^/]+[/][^/]+\/)$/;
159
- const MODULE_REQUEST_REGEX = /^[^?]*~/;
160
-
161
- /**
162
- * Creates a Less plugin that uses webpack's resolving engine that is provided by the loaderContext.
163
- *
164
- * @param {LoaderContext} loaderContext
165
- * @param {object} implementation
166
- * @returns {LessPlugin}
167
- */
168
- function createWebpackLessPlugin(loaderContext, implementation) {
169
- const resolve = loaderContext.getResolve({
170
- dependencyType: "less",
171
- conditionNames: ["less", "style", "..."],
172
- mainFields: ["less", "style", "main", "..."],
173
- mainFiles: ["index", "..."],
174
- extensions: [".less", ".css"],
175
- preferRelative: true
176
- });
177
- class WebpackFileManager extends implementation.FileManager {
178
- supports(filename) {
179
- if (filename[0] === "/" || IS_NATIVE_WIN32_PATH.test(filename)) {
180
- return true;
181
- }
182
- if (this.isPathAbsolute(filename)) {
183
- return false;
184
- }
185
- return true;
186
- }
187
-
188
- // Sync resolving is used at least by the `data-uri` function.
189
- // This file manager doesn't know how to do it, so let's delegate it
190
- // to the default file manager of Less.
191
- // We could probably use loaderContext.resolveSync, but it's deprecated,
192
- // see https://webpack.js.org/api/loaders/#this-resolvesync
193
- supportsSync() {
194
- return false;
195
- }
196
- async resolveFilename(filename, currentDirectory) {
197
- // Less is giving us trailing slashes, but the context should have no trailing slash
198
- const context = currentDirectory.replace(trailingSlash, "");
199
- let request = filename;
200
-
201
- // A `~` makes the url an module
202
- if (MODULE_REQUEST_REGEX.test(filename)) {
203
- request = request.replace(MODULE_REQUEST_REGEX, "");
204
- }
205
- if (IS_MODULE_IMPORT.test(filename)) {
206
- request = request[request.length - 1] === "/" ? request : `${request}/`;
207
- }
208
- return this.resolveRequests(context, [...new Set([request, filename])]);
209
- }
210
- async resolveRequests(context, possibleRequests) {
211
- if (possibleRequests.length === 0) {
212
- return Promise.reject();
213
- }
214
- let result;
215
- try {
216
- result = await resolve(context, possibleRequests[0]);
217
- } catch (error) {
218
- const [, ...tailPossibleRequests] = possibleRequests;
219
- if (tailPossibleRequests.length === 0) {
220
- throw error;
221
- }
222
- result = await this.resolveRequests(context, tailPossibleRequests);
223
- }
224
- return result;
225
- }
226
- async loadFile(filename, ...args) {
227
- let result;
228
- try {
229
- if (IS_SPECIAL_MODULE_IMPORT.test(filename)) {
230
- const error = new Error();
231
- error.type = "Next";
232
- throw error;
233
- }
234
- result = await super.loadFile(filename, ...args);
235
- } catch (error) {
236
- if (error.type !== "File" && error.type !== "Next") {
237
- return Promise.reject(error);
238
- }
239
- try {
240
- result = await this.resolveFilename(filename, ...args);
241
- } catch (webpackResolveError) {
242
- 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`;
243
- return Promise.reject(error);
244
- }
245
- loaderContext.addDependency(result);
246
- return super.loadFile(result, ...args);
247
- }
248
- const absoluteFilename = _path.default.isAbsolute(result.filename) ? result.filename : _path.default.resolve(".", result.filename);
249
- loaderContext.addDependency(_path.default.normalize(absoluteFilename));
250
- return result;
251
- }
252
- }
253
- return {
254
- install(lessInstance, pluginManager) {
255
- pluginManager.addFileManager(new WebpackFileManager());
256
- },
257
- minVersion: [3, 0, 0]
258
- };
259
- }
260
-
261
- /**
262
- * Get the `less` options from the loader context and normalizes its values
263
- *
264
- * @param {object} loaderContext
265
- * @param {object} loaderOptions
266
- * @param {object} implementation
267
- * @returns {Object}
268
- */
269
- function getLessOptions(loaderContext, loaderOptions, implementation) {
270
- const options = typeof loaderOptions.lessOptions === "function" ? loaderOptions.lessOptions(loaderContext) || {} : loaderOptions.lessOptions || {};
271
- const lessOptions = {
272
- plugins: [],
273
- relativeUrls: true,
274
- // We need to set the filename because otherwise our WebpackFileManager will receive an undefined path for the entry
275
- filename: loaderContext.resourcePath,
276
- ...options
277
- };
278
- const plugins = lessOptions.plugins.slice();
279
- const shouldUseWebpackImporter = typeof loaderOptions.webpackImporter === "boolean" ? loaderOptions.webpackImporter : true;
280
- if (shouldUseWebpackImporter) {
281
- plugins.unshift(createWebpackLessPlugin(loaderContext, implementation));
282
- }
283
- plugins.unshift({
284
- install(lessProcessor, pluginManager) {
285
- // eslint-disable-next-line no-param-reassign
286
- pluginManager.webpackLoaderContext = loaderContext;
287
- lessOptions.pluginManager = pluginManager;
288
- }
289
- });
290
- lessOptions.plugins = plugins;
291
- return lessOptions;
292
- }
293
- function isUnsupportedUrl(url) {
294
- // Is Windows path
295
- if (IS_NATIVE_WIN32_PATH.test(url)) {
296
- return false;
297
- }
298
-
299
- // Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
300
- // Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
301
- return /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url);
302
- }
303
- function normalizeSourceMap(map) {
304
- const newMap = map;
305
-
306
- // map.file is an optional property that provides the output filename.
307
- // Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
308
- // eslint-disable-next-line no-param-reassign
309
- delete newMap.file;
310
-
311
- // eslint-disable-next-line no-param-reassign
312
- newMap.sourceRoot = "";
313
-
314
- // `less` returns POSIX paths, that's why we need to transform them back to native paths.
315
- // eslint-disable-next-line no-param-reassign
316
- newMap.sources = newMap.sources.map(source => _path.default.normalize(source));
317
- return newMap;
318
- }
319
- function getLessImplementation(loaderContext, implementation) {
320
- let resolvedImplementation = implementation;
321
- if (!implementation || typeof implementation === "string") {
322
- const lessImplPkg = implementation || "less";
323
-
324
- // eslint-disable-next-line import/no-dynamic-require, global-require
325
- resolvedImplementation = require(lessImplPkg);
326
- }
327
-
328
- // eslint-disable-next-line consistent-return
329
- return resolvedImplementation;
330
- }
331
- function getFileExcerptIfPossible(error) {
332
- if (typeof error.extract === "undefined") {
333
- return [];
334
- }
335
- const excerpt = error.extract.slice(0, 2);
336
- const column = Math.max(error.column - 1, 0);
337
- if (typeof excerpt[0] === "undefined") {
338
- excerpt.shift();
339
- }
340
- excerpt.push(`${new Array(column).join(" ")}^`);
341
- return excerpt;
342
- }
343
- function errorFactory(error) {
344
- 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");
345
- const obj = new Error(message, {
346
- cause: error
347
- });
348
- obj.stack = null;
349
- return obj;
350
- }
351
-
352
- /***/ }),
353
-
354
- /***/ 17:
355
- /***/ ((module) => {
356
-
357
- module.exports = require("path");
358
-
359
- /***/ }),
360
-
361
- /***/ 649:
362
- /***/ ((module) => {
363
-
364
- module.exports = JSON.parse('{"title":"Less Loader options","type":"object","properties":{"lessOptions":{"description":"Options to pass through to `Less`.","link":"https://github.com/webpack-contrib/less-loader#lessoptions","anyOf":[{"type":"object","additionalProperties":true},{"instanceof":"Function"}]},"additionalData":{"description":"Prepends/Appends `Less` code to the actual entry file.","link":"https://github.com/webpack-contrib/less-loader#additionalData","anyOf":[{"type":"string"},{"instanceof":"Function"}]},"sourceMap":{"description":"Enables/Disables generation of source maps.","link":"https://github.com/webpack-contrib/less-loader#sourcemap","type":"boolean"},"webpackImporter":{"description":"Enables/Disables default `webpack` importer.","link":"https://github.com/webpack-contrib/less-loader#webpackimporter","type":"boolean"},"implementation":{"description":"The implementation of the `Less` to be used.","link":"https://github.com/webpack-contrib/less-loader#implementation","anyOf":[{"type":"string"},{"type":"object"}]},"lessLogAsWarnOrErr":{"description":"Less warnings and errors will be webpack warnings or errors.","link":"https://github.com/webpack-contrib/less-loader#lesslogaswarnorerr","type":"boolean"}},"additionalProperties":false}');
365
-
366
- /***/ })
367
-
368
- /******/ });
369
- /************************************************************************/
370
- /******/ // The module cache
371
- /******/ var __webpack_module_cache__ = {};
372
- /******/
373
- /******/ // The require function
374
- /******/ function __nccwpck_require__(moduleId) {
375
- /******/ // Check if module is in cache
376
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
377
- /******/ if (cachedModule !== undefined) {
378
- /******/ return cachedModule.exports;
379
- /******/ }
380
- /******/ // Create a new module (and put it into the cache)
381
- /******/ var module = __webpack_module_cache__[moduleId] = {
382
- /******/ // no module.id needed
383
- /******/ // no module.loaded needed
384
- /******/ exports: {}
385
- /******/ };
386
- /******/
387
- /******/ // Execute the module function
388
- /******/ var threw = true;
389
- /******/ try {
390
- /******/ __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
391
- /******/ threw = false;
392
- /******/ } finally {
393
- /******/ if(threw) delete __webpack_module_cache__[moduleId];
394
- /******/ }
395
- /******/
396
- /******/ // Return the exports of the module
397
- /******/ return module.exports;
398
- /******/ }
399
- /******/
400
- /************************************************************************/
401
- /******/ /* webpack/runtime/compat */
402
- /******/
403
- /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
404
- /******/
405
- /************************************************************************/
406
- /******/
407
- /******/ // startup
408
- /******/ // Load entry module and return exports
409
- /******/ // This entry module used 'module' so it can't be inlined
410
- /******/ var __webpack_exports__ = __nccwpck_require__(949);
411
- /******/ module.exports = __webpack_exports__;
412
- /******/
413
- /******/ })()
414
- ;
@@ -1,20 +0,0 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1 +0,0 @@
1
- {"name":"less-loader","author":"Johannes Ewald @jhnns","version":"12.2.0","funding":{"type":"opencollective","url":"https://opencollective.com/webpack"},"license":"MIT","types":"index.d.ts","type":"commonjs"}