@rspack/core 1.0.0-alpha.3 → 1.0.0-alpha.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 (48) hide show
  1. package/compiled/browserslist/index.js +17 -17
  2. package/compiled/enhanced-resolve/index.js +107 -107
  3. package/compiled/graceful-fs/index.js +8 -8
  4. package/compiled/json-parse-even-better-errors/index.js +2 -2
  5. package/compiled/neo-async/index.js +2 -2
  6. package/compiled/watchpack/index.js +15 -15
  7. package/compiled/webpack-sources/index.js +76 -76
  8. package/compiled/zod/index.js +30 -30
  9. package/compiled/zod-validation-error/index.js +6 -6
  10. package/dist/Compilation.js +2 -3
  11. package/dist/ErrorHelpers.d.ts +16 -7
  12. package/dist/ErrorHelpers.js +34 -33
  13. package/dist/ExecuteModulePlugin.js +1 -1
  14. package/dist/Module.d.ts +1 -2
  15. package/dist/Module.js +2 -6
  16. package/dist/MultiCompiler.js +1 -1
  17. package/dist/ResolverFactory.d.ts +5 -1
  18. package/dist/ResolverFactory.js +7 -1
  19. package/dist/RuntimeGlobals.js +3 -3
  20. package/dist/Stats.js +4 -4
  21. package/dist/Template.js +2 -2
  22. package/dist/builtin-plugin/DefinePlugin.js +2 -2
  23. package/dist/builtin-plugin/EntryPlugin.js +1 -1
  24. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +10 -2
  25. package/dist/builtin-plugin/SwcCssMinimizerPlugin.js +7 -1
  26. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +2 -2
  27. package/dist/builtin-plugin/WorkerPlugin.js +5 -1
  28. package/dist/builtin-plugin/base.js +1 -1
  29. package/dist/builtin-plugin/css-extract/loader.js +3 -3
  30. package/dist/config/adapter.d.ts +1 -1
  31. package/dist/config/adapter.js +20 -9
  32. package/dist/config/adapterRuleUse.js +1 -1
  33. package/dist/config/browserslistTargetHandler.js +1 -1
  34. package/dist/config/defaults.js +4 -3
  35. package/dist/config/zod.d.ts +110 -3
  36. package/dist/config/zod.js +42 -39
  37. package/dist/container/ModuleFederationPlugin.js +2 -2
  38. package/dist/loader-runner/index.js +6 -6
  39. package/dist/logging/runtime.js +1 -1
  40. package/dist/rspack.js +1 -1
  41. package/dist/sharing/ConsumeSharedPlugin.js +1 -1
  42. package/dist/stats/DefaultStatsFactoryPlugin.js +246 -46
  43. package/dist/stats/DefaultStatsPresetPlugin.js +17 -17
  44. package/dist/stats/DefaultStatsPrinterPlugin.js +1 -1
  45. package/dist/stats/statsFactoryUtils.d.ts +15 -0
  46. package/dist/util/identifier.d.ts +65 -62
  47. package/dist/util/identifier.js +30 -55
  48. package/package.json +6 -3
@@ -2,13 +2,13 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ 872:
5
+ /***/ 533:
6
6
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10
10
  exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
11
- const util_1 = __nccwpck_require__(306);
11
+ const util_1 = __nccwpck_require__(276);
12
12
  exports.ZodIssueCode = util_1.util.arrayToEnum([
13
13
  "invalid_type",
14
14
  "invalid_literal",
@@ -141,7 +141,7 @@ ZodError.create = (issues) => {
141
141
 
142
142
  /***/ }),
143
143
 
144
- /***/ 681:
144
+ /***/ 347:
145
145
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
146
146
 
147
147
 
@@ -150,7 +150,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
150
150
  };
151
151
  Object.defineProperty(exports, "__esModule", ({ value: true }));
152
152
  exports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;
153
- const en_1 = __importDefault(__nccwpck_require__(852));
153
+ const en_1 = __importDefault(__nccwpck_require__(56));
154
154
  exports.defaultErrorMap = en_1.default;
155
155
  let overrideErrorMap = en_1.default;
156
156
  function setErrorMap(map) {
@@ -165,7 +165,7 @@ exports.getErrorMap = getErrorMap;
165
165
 
166
166
  /***/ }),
167
167
 
168
- /***/ 508:
168
+ /***/ 961:
169
169
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
170
170
 
171
171
 
@@ -180,17 +180,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
180
180
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
181
181
  };
182
182
  Object.defineProperty(exports, "__esModule", ({ value: true }));
183
- __exportStar(__nccwpck_require__(681), exports);
184
- __exportStar(__nccwpck_require__(749), exports);
185
- __exportStar(__nccwpck_require__(1), exports);
186
- __exportStar(__nccwpck_require__(306), exports);
187
- __exportStar(__nccwpck_require__(763), exports);
188
- __exportStar(__nccwpck_require__(872), exports);
183
+ __exportStar(__nccwpck_require__(347), exports);
184
+ __exportStar(__nccwpck_require__(825), exports);
185
+ __exportStar(__nccwpck_require__(764), exports);
186
+ __exportStar(__nccwpck_require__(276), exports);
187
+ __exportStar(__nccwpck_require__(355), exports);
188
+ __exportStar(__nccwpck_require__(533), exports);
189
189
 
190
190
 
191
191
  /***/ }),
192
192
 
193
- /***/ 750:
193
+ /***/ 429:
194
194
  /***/ ((__unused_webpack_module, exports) => {
195
195
 
196
196
 
@@ -205,7 +205,7 @@ var errorUtil;
205
205
 
206
206
  /***/ }),
207
207
 
208
- /***/ 749:
208
+ /***/ 825:
209
209
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
210
210
 
211
211
 
@@ -214,8 +214,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
214
214
  };
215
215
  Object.defineProperty(exports, "__esModule", ({ value: true }));
216
216
  exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue = void 0;
217
- const errors_1 = __nccwpck_require__(681);
218
- const en_1 = __importDefault(__nccwpck_require__(852));
217
+ const errors_1 = __nccwpck_require__(347);
218
+ const en_1 = __importDefault(__nccwpck_require__(56));
219
219
  const makeIssue = (params) => {
220
220
  const { data, path, errorMaps, issueData } = params;
221
221
  const fullPath = [...path, ...(issueData.path || [])];
@@ -327,7 +327,7 @@ exports.isAsync = isAsync;
327
327
 
328
328
  /***/ }),
329
329
 
330
- /***/ 1:
330
+ /***/ 764:
331
331
  /***/ ((__unused_webpack_module, exports) => {
332
332
 
333
333
 
@@ -336,7 +336,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
336
336
 
337
337
  /***/ }),
338
338
 
339
- /***/ 306:
339
+ /***/ 276:
340
340
  /***/ ((__unused_webpack_module, exports) => {
341
341
 
342
342
 
@@ -485,7 +485,7 @@ exports.getParsedType = getParsedType;
485
485
 
486
486
  /***/ }),
487
487
 
488
- /***/ 762:
488
+ /***/ 353:
489
489
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
490
490
 
491
491
 
@@ -513,21 +513,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
513
513
  };
514
514
  Object.defineProperty(exports, "__esModule", ({ value: true }));
515
515
  exports.z = void 0;
516
- const z = __importStar(__nccwpck_require__(508));
516
+ const z = __importStar(__nccwpck_require__(961));
517
517
  exports.z = z;
518
- __exportStar(__nccwpck_require__(508), exports);
518
+ __exportStar(__nccwpck_require__(961), exports);
519
519
  exports["default"] = z;
520
520
 
521
521
 
522
522
  /***/ }),
523
523
 
524
- /***/ 852:
524
+ /***/ 56:
525
525
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
526
526
 
527
527
 
528
528
  Object.defineProperty(exports, "__esModule", ({ value: true }));
529
- const util_1 = __nccwpck_require__(306);
530
- const ZodError_1 = __nccwpck_require__(872);
529
+ const util_1 = __nccwpck_require__(276);
530
+ const ZodError_1 = __nccwpck_require__(533);
531
531
  const errorMap = (issue, _ctx) => {
532
532
  let message;
533
533
  switch (issue.code) {
@@ -657,18 +657,18 @@ exports["default"] = errorMap;
657
657
 
658
658
  /***/ }),
659
659
 
660
- /***/ 763:
660
+ /***/ 355:
661
661
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
662
662
 
663
663
 
664
664
  Object.defineProperty(exports, "__esModule", ({ value: true }));
665
665
  exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
666
666
  exports.NEVER = exports["void"] = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports["null"] = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports["instanceof"] = exports["function"] = exports["enum"] = exports.effect = exports.discriminatedUnion = void 0;
667
- const errors_1 = __nccwpck_require__(681);
668
- const errorUtil_1 = __nccwpck_require__(750);
669
- const parseUtil_1 = __nccwpck_require__(749);
670
- const util_1 = __nccwpck_require__(306);
671
- const ZodError_1 = __nccwpck_require__(872);
667
+ const errors_1 = __nccwpck_require__(347);
668
+ const errorUtil_1 = __nccwpck_require__(429);
669
+ const parseUtil_1 = __nccwpck_require__(825);
670
+ const util_1 = __nccwpck_require__(276);
671
+ const ZodError_1 = __nccwpck_require__(533);
672
672
  class ParseInputLazyPath {
673
673
  constructor(parent, value, path, key) {
674
674
  this._cachedPath = [];
@@ -4201,7 +4201,7 @@ exports.NEVER = parseUtil_1.INVALID;
4201
4201
  /******/ // startup
4202
4202
  /******/ // Load entry module and return exports
4203
4203
  /******/ // This entry module is referenced by other modules so it can't be inlined
4204
- /******/ var __webpack_exports__ = __nccwpck_require__(762);
4204
+ /******/ var __webpack_exports__ = __nccwpck_require__(353);
4205
4205
  /******/ module.exports = __webpack_exports__;
4206
4206
  /******/
4207
4207
  /******/ })()
@@ -2,7 +2,7 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ 353:
5
+ /***/ 479:
6
6
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
7
7
 
8
8
 
@@ -32,8 +32,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
32
32
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33
33
  exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.fromZodError = exports.ValidationError = void 0;
34
34
  const zod = __importStar(__nccwpck_require__(934));
35
- const joinPath_1 = __nccwpck_require__(991);
36
- const NonEmptyArray_1 = __nccwpck_require__(355);
35
+ const joinPath_1 = __nccwpck_require__(14);
36
+ const NonEmptyArray_1 = __nccwpck_require__(80);
37
37
  class ValidationError extends Error {
38
38
  details;
39
39
  name;
@@ -104,7 +104,7 @@ exports.isValidationErrorLike = isValidationErrorLike;
104
104
 
105
105
  /***/ }),
106
106
 
107
- /***/ 355:
107
+ /***/ 80:
108
108
  /***/ ((__unused_webpack_module, exports) => {
109
109
 
110
110
 
@@ -118,7 +118,7 @@ exports.isNonEmptyArray = isNonEmptyArray;
118
118
 
119
119
  /***/ }),
120
120
 
121
- /***/ 991:
121
+ /***/ 14:
122
122
  /***/ ((__unused_webpack_module, exports) => {
123
123
 
124
124
 
@@ -203,7 +203,7 @@ var exports = __webpack_exports__;
203
203
 
204
204
  Object.defineProperty(exports, "__esModule", ({ value: true }));
205
205
  exports.fromZodError = exports.isValidationErrorLike = exports.isValidationError = exports.toValidationError = exports.ValidationError = void 0;
206
- var ValidationError_1 = __nccwpck_require__(353);
206
+ var ValidationError_1 = __nccwpck_require__(479);
207
207
  Object.defineProperty(exports, "ValidationError", ({ enumerable: true, get: function () { return ValidationError_1.ValidationError; } }));
208
208
  Object.defineProperty(exports, "toValidationError", ({ enumerable: true, get: function () { return ValidationError_1.toValidationError; } }));
209
209
  Object.defineProperty(exports, "isValidationError", ({ enumerable: true, get: function () { return ValidationError_1.isValidationError; } }));
@@ -44,7 +44,7 @@ const liteTapable = __importStar(require("@rspack/lite-tapable"));
44
44
  const Chunk_1 = require("./Chunk");
45
45
  const ChunkGraph_1 = require("./ChunkGraph");
46
46
  const Entrypoint_1 = require("./Entrypoint");
47
- const ErrorHelpers_1 = __importDefault(require("./ErrorHelpers"));
47
+ const ErrorHelpers_1 = require("./ErrorHelpers");
48
48
  const Module_1 = require("./Module");
49
49
  const Stats_1 = require("./Stats");
50
50
  const Logger_1 = require("./logging/Logger");
@@ -513,7 +513,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
513
513
  case Logger_1.LogType.warn:
514
514
  case Logger_1.LogType.error:
515
515
  case Logger_1.LogType.trace:
516
- trace = ErrorHelpers_1.default.cutOffLoaderExecution(new Error("Trace").stack)
516
+ trace = (0, ErrorHelpers_1.cutOffLoaderExecution)(new Error("Trace").stack)
517
517
  .split("\n")
518
518
  .slice(3);
519
519
  break;
@@ -522,7 +522,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
522
522
  time: Date.now(),
523
523
  type,
524
524
  args,
525
- // @ts-expect-error
526
525
  trace
527
526
  };
528
527
  if (this.hooks.log.call(name, logEntry) === undefined) {
@@ -1,7 +1,16 @@
1
- export function cutOffByFlag(stack: any, flag: any): any;
2
- export function cutOffLoaderExecution(stack: any): any;
3
- export function cutOffWebpackOptions(stack: any): any;
4
- export function cutOffMultilineMessage(stack: any, message: any): string;
5
- export function cutOffMessage(stack: any, message: any): any;
6
- export function cleanUp(stack: any, message: any): any;
7
- export function cleanUpWebpackOptions(stack: any, message: any): any;
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/ErrorHelpers.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
10
+ export declare const cutOffByFlag: (stack: string, flag: string) => string;
11
+ export declare const cutOffLoaderExecution: (stack: string) => string;
12
+ export declare const cutOffWebpackOptions: (stack: string) => string;
13
+ export declare const cutOffMultilineMessage: (stack: string, message: string) => string;
14
+ export declare const cutOffMessage: (stack: string, message: string) => string;
15
+ export declare const cleanUp: (stack: string, message: string) => string;
16
+ export declare const cleanUpWebpackOptions: (stack: string, message: string) => string;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * The following code is modified based on
3
4
  * https://github.com/webpack/webpack/blob/4b4ca3b/lib/ErrorHelpers.js
@@ -7,39 +8,36 @@
7
8
  * Copyright (c) JS Foundation and other contributors
8
9
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
10
  */
10
- "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.cleanUpWebpackOptions = exports.cleanUp = exports.cutOffMessage = exports.cutOffMultilineMessage = exports.cutOffWebpackOptions = exports.cutOffLoaderExecution = exports.cutOffByFlag = void 0;
11
13
  const loaderFlag = "LOADER_EXECUTION";
12
14
  const webpackOptionsFlag = "WEBPACK_OPTIONS";
13
- // @ts-expect-error
14
- exports.cutOffByFlag = (stack, flag) => {
15
- stack = stack.split("\n");
16
- for (let i = 0; i < stack.length; i++) {
17
- if (stack[i].includes(flag)) {
18
- stack.length = i;
15
+ const cutOffByFlag = (stack, flag) => {
16
+ const stacks = stack.split("\n");
17
+ for (let i = 0; i < stacks.length; i++) {
18
+ if (stacks[i].includes(flag)) {
19
+ stacks.length = i;
19
20
  }
20
21
  }
21
- return stack.join("\n");
22
+ return stacks.join("\n");
22
23
  };
23
- // @ts-expect-error
24
- exports.cutOffLoaderExecution = stack => exports.cutOffByFlag(stack, loaderFlag);
25
- // @ts-expect-error
26
- exports.cutOffWebpackOptions = stack => exports.cutOffByFlag(stack, webpackOptionsFlag);
27
- // @ts-expect-error
28
- exports.cutOffMultilineMessage = (stack, message) => {
29
- stack = stack.split("\n");
30
- message = message.split("\n");
31
- // @ts-expect-error
24
+ exports.cutOffByFlag = cutOffByFlag;
25
+ const cutOffLoaderExecution = (stack) => (0, exports.cutOffByFlag)(stack, loaderFlag);
26
+ exports.cutOffLoaderExecution = cutOffLoaderExecution;
27
+ const cutOffWebpackOptions = (stack) => (0, exports.cutOffByFlag)(stack, webpackOptionsFlag);
28
+ exports.cutOffWebpackOptions = cutOffWebpackOptions;
29
+ const cutOffMultilineMessage = (stack, message) => {
30
+ const stacks = stack.split("\n");
31
+ const messages = message.split("\n");
32
32
  const result = [];
33
- // @ts-expect-error
34
- stack.forEach((line, idx) => {
35
- if (!line.includes(message[idx]))
33
+ stacks.forEach((line, idx) => {
34
+ if (!line.includes(messages[idx]))
36
35
  result.push(line);
37
36
  });
38
- // @ts-expect-error
39
37
  return result.join("\n");
40
38
  };
41
- // @ts-expect-error
42
- exports.cutOffMessage = (stack, message) => {
39
+ exports.cutOffMultilineMessage = cutOffMultilineMessage;
40
+ const cutOffMessage = (stack, message) => {
43
41
  const nextLine = stack.indexOf("\n");
44
42
  if (nextLine === -1) {
45
43
  return stack === message ? "" : stack;
@@ -49,15 +47,18 @@ exports.cutOffMessage = (stack, message) => {
49
47
  return firstLine === message ? stack.slice(nextLine + 1) : stack;
50
48
  }
51
49
  };
52
- // @ts-expect-error
53
- exports.cleanUp = (stack, message) => {
54
- stack = exports.cutOffLoaderExecution(stack);
55
- stack = exports.cutOffMessage(stack, message);
56
- return stack;
50
+ exports.cutOffMessage = cutOffMessage;
51
+ const cleanUp = (stack, message) => {
52
+ let str = stack;
53
+ str = (0, exports.cutOffLoaderExecution)(str);
54
+ str = (0, exports.cutOffMessage)(str, message);
55
+ return str;
57
56
  };
58
- // @ts-expect-error
59
- exports.cleanUpWebpackOptions = (stack, message) => {
60
- stack = exports.cutOffWebpackOptions(stack);
61
- stack = exports.cutOffMultilineMessage(stack, message);
62
- return stack;
57
+ exports.cleanUp = cleanUp;
58
+ const cleanUpWebpackOptions = (stack, message) => {
59
+ let str = stack;
60
+ str = (0, exports.cutOffWebpackOptions)(str);
61
+ str = (0, exports.cutOffMultilineMessage)(str, message);
62
+ return str;
63
63
  };
64
+ exports.cleanUpWebpackOptions = cleanUpWebpackOptions;
@@ -19,7 +19,7 @@ class ExecuteModulePlugin {
19
19
  fn.call(moduleObject.exports, moduleObject, moduleObject, moduleObject.exports, moduleObject.exports, context.__webpack_require__);
20
20
  }
21
21
  catch (e) {
22
- let err = e instanceof Error ? e : new Error(e);
22
+ const err = e instanceof Error ? e : new Error(e);
23
23
  err.stack += printGeneratedCodeForStack(moduleObject.id, source);
24
24
  throw err;
25
25
  }
package/dist/Module.d.ts CHANGED
@@ -67,6 +67,5 @@ export declare class CodeGenerationResult {
67
67
  get(sourceType: string): string;
68
68
  }
69
69
  export declare class CodeGenerationResults {
70
- #private;
71
- constructor(result: JsCodegenerationResults);
70
+ constructor(_result: JsCodegenerationResults);
72
71
  }
package/dist/Module.js CHANGED
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _Module_inner, _Module_originalSource, _CodeGenerationResult_inner, _CodeGenerationResults_inner;
13
+ var _Module_inner, _Module_originalSource, _CodeGenerationResult_inner;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = void 0;
16
16
  const source_1 = require("./util/source");
@@ -70,10 +70,6 @@ class CodeGenerationResult {
70
70
  exports.CodeGenerationResult = CodeGenerationResult;
71
71
  _CodeGenerationResult_inner = new WeakMap();
72
72
  class CodeGenerationResults {
73
- constructor(result) {
74
- _CodeGenerationResults_inner.set(this, void 0);
75
- __classPrivateFieldSet(this, _CodeGenerationResults_inner, result, "f");
76
- }
73
+ constructor(_result) { }
77
74
  }
78
75
  exports.CodeGenerationResults = CodeGenerationResults;
79
- _CodeGenerationResults_inner = new WeakMap();
@@ -67,7 +67,7 @@ class MultiCompiler {
67
67
  };
68
68
  this.compilers = compilers;
69
69
  this._options = {
70
- parallelism: options?.parallelism || Infinity
70
+ parallelism: options?.parallelism || Number.POSITIVE_INFINITY
71
71
  };
72
72
  this.dependencies = new WeakMap();
73
73
  this.running = false;
@@ -1,6 +1,10 @@
1
1
  import * as binding from "@rspack/binding";
2
2
  import { Resolver } from "./Resolver";
3
- type ResolveOptionsWithDependencyType = binding.RawResolveOptionsWithDependencyType;
3
+ import { type Resolve } from "./config";
4
+ type ResolveOptionsWithDependencyType = Resolve & {
5
+ dependencyCategory?: string;
6
+ resolveToContext?: boolean;
7
+ };
4
8
  export declare class ResolverFactory {
5
9
  #private;
6
10
  static __to_binding(resolver_factory: ResolverFactory): binding.JsResolverFactory;
@@ -38,6 +38,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.ResolverFactory = void 0;
39
39
  const binding = __importStar(require("@rspack/binding"));
40
40
  const Resolver_1 = require("./Resolver");
41
+ const config_1 = require("./config");
41
42
  class ResolverFactory {
42
43
  static __to_binding(resolver_factory) {
43
44
  return __classPrivateFieldGet(resolver_factory, _ResolverFactory_binding, "f");
@@ -47,7 +48,12 @@ class ResolverFactory {
47
48
  __classPrivateFieldSet(this, _ResolverFactory_binding, new binding.JsResolverFactory(), "f");
48
49
  }
49
50
  get(type, resolveOptions) {
50
- const binding = __classPrivateFieldGet(this, _ResolverFactory_binding, "f").get(type, resolveOptions);
51
+ const { dependencyCategory, resolveToContext, ...resolve } = resolveOptions || {};
52
+ const binding = __classPrivateFieldGet(this, _ResolverFactory_binding, "f").get(type, {
53
+ ...(0, config_1.getRawResolve)(resolve),
54
+ dependencyCategory,
55
+ resolveToContext
56
+ });
51
57
  return new Resolver_1.Resolver(binding);
52
58
  }
53
59
  }
@@ -13,7 +13,7 @@ exports.RuntimeGlobals = exports.__to_binding_runtime_globals = exports.__from_b
13
13
  const REVERSE_RUNTIME_GLOBALS = new Map();
14
14
  function __from_binding_runtime_globals(runtimeRequirements) {
15
15
  const res = new Set();
16
- for (let flag of runtimeRequirements.value) {
16
+ for (const flag of runtimeRequirements.value) {
17
17
  if (flag in exports.RuntimeGlobals) {
18
18
  res.add(exports.RuntimeGlobals[flag]);
19
19
  }
@@ -28,7 +28,7 @@ function __to_binding_runtime_globals(runtimeRequirements) {
28
28
  const res = {
29
29
  value: []
30
30
  };
31
- for (let flag of Array.from(runtimeRequirements)) {
31
+ for (const flag of Array.from(runtimeRequirements)) {
32
32
  const item = REVERSE_RUNTIME_GLOBALS.get(flag);
33
33
  if (typeof item === "string") {
34
34
  res.value.push(item);
@@ -352,6 +352,6 @@ exports.RuntimeGlobals = {
352
352
  */
353
353
  asyncModule: "__webpack_require__.a"
354
354
  };
355
- for (let entry of Object.entries(exports.RuntimeGlobals)) {
355
+ for (const entry of Object.entries(exports.RuntimeGlobals)) {
356
356
  REVERSE_RUNTIME_GLOBALS.set(entry[1], entry[0]);
357
357
  }
package/dist/Stats.js CHANGED
@@ -102,7 +102,7 @@ function normalizeStatsPreset(options) {
102
102
  else if (!options)
103
103
  return {};
104
104
  else {
105
- let obj = { ...presetToOptions(options.preset), ...options };
105
+ const obj = { ...presetToOptions(options.preset), ...options };
106
106
  delete obj.preset;
107
107
  return obj;
108
108
  }
@@ -118,15 +118,15 @@ function presetToOptions(name) {
118
118
  case "verbose":
119
119
  return {
120
120
  all: true,
121
- modulesSpace: Infinity
121
+ modulesSpace: Number.POSITIVE_INFINITY
122
122
  };
123
123
  case "errors-only":
124
124
  return {
125
125
  all: false,
126
126
  errors: true,
127
127
  errorsCount: true,
128
- logging: "error"
129
- // TODO: moduleTrace: true,
128
+ logging: "error",
129
+ moduleTrace: true
130
130
  };
131
131
  case "errors-warnings":
132
132
  return {
package/dist/Template.js CHANGED
@@ -246,8 +246,8 @@ class Template {
246
246
  * or false if not every module has a number based id
247
247
  */
248
248
  static getModulesArrayBounds(modules) {
249
- let maxId = -Infinity;
250
- let minId = Infinity;
249
+ let maxId = Number.NEGATIVE_INFINITY;
250
+ let minId = Number.POSITIVE_INFINITY;
251
251
  for (const module of modules) {
252
252
  const moduleId = module.id;
253
253
  if (typeof moduleId !== "number")
@@ -4,7 +4,7 @@ exports.DefinePlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
6
  exports.DefinePlugin = (0, base_1.create)(binding_1.BuiltinPluginName.DefinePlugin, function (define) {
7
- let supportsBigIntLiteral = this.options.output.environment?.bigIntLiteral ?? false;
7
+ const supportsBigIntLiteral = this.options.output.environment?.bigIntLiteral ?? false;
8
8
  return normalizeValue(define, supportsBigIntLiteral);
9
9
  }, "compilation");
10
10
  const normalizeValue = (define, supportsBigIntLiteral) => {
@@ -37,7 +37,7 @@ const normalizeValue = (define, supportsBigIntLiteral) => {
37
37
  return normalizePrimitive(define);
38
38
  }
39
39
  else if (define && typeof define === "object") {
40
- let keys = Object.keys(define);
40
+ const keys = Object.keys(define);
41
41
  return Object.fromEntries(keys.map(k => [k, normalizeObject(define[k])]));
42
42
  }
43
43
  else {
@@ -6,7 +6,7 @@ const config_1 = require("../config");
6
6
  const util_1 = require("../util");
7
7
  const base_1 = require("./base");
8
8
  exports.EntryPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EntryPlugin, (context, entry, options = "") => {
9
- let entryOptions = typeof options === "string" ? { name: options } : options;
9
+ const entryOptions = typeof options === "string" ? { name: options } : options;
10
10
  return {
11
11
  context,
12
12
  entry,
@@ -1,10 +1,18 @@
1
1
  import { BuiltinPluginName } from "@rspack/binding";
2
+ type MinifyCondition = string | RegExp;
3
+ type MinifyConditions = MinifyCondition | MinifyCondition[];
4
+ export type SwcCssMinimizerRspackPluginOptions = {
5
+ test?: MinifyConditions;
6
+ exclude?: MinifyConditions;
7
+ include?: MinifyConditions;
8
+ };
2
9
  export declare const SwcCssMinimizerRspackPlugin: {
3
- new (options?: any): {
10
+ new (options?: SwcCssMinimizerRspackPluginOptions | undefined): {
4
11
  name: BuiltinPluginName;
5
- _args: [options?: any];
12
+ _args: [options?: SwcCssMinimizerRspackPluginOptions | undefined];
6
13
  affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
14
  raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
8
15
  apply(compiler: import("../Compiler").Compiler): void;
9
16
  };
10
17
  };
18
+ export {};
@@ -3,4 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SwcCssMinimizerRspackPlugin = void 0;
4
4
  const binding_1 = require("@rspack/binding");
5
5
  const base_1 = require("./base");
6
- exports.SwcCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcCssMinimizerRspackPlugin, (options /* TODO: extend more options */) => undefined);
6
+ exports.SwcCssMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcCssMinimizerRspackPlugin, (options) => {
7
+ return {
8
+ test: options?.test,
9
+ include: options?.include,
10
+ exclude: options?.exclude
11
+ };
12
+ });
@@ -56,8 +56,8 @@ function getRawExtractCommentsOptions(extractComments) {
56
56
  }
57
57
  exports.SwcJsMinimizerRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.SwcJsMinimizerRspackPlugin, (options) => {
58
58
  let compress = options?.compress ?? true;
59
- let mangle = options?.mangle ?? true;
60
- let format = {
59
+ const mangle = options?.mangle ?? true;
60
+ const format = {
61
61
  comments: false,
62
62
  ...options?.format
63
63
  };
@@ -6,7 +6,11 @@ const EnableChunkLoadingPlugin_1 = require("./EnableChunkLoadingPlugin");
6
6
  const EnableWasmLoadingPlugin_1 = require("./EnableWasmLoadingPlugin");
7
7
  const base_1 = require("./base");
8
8
  class WorkerPlugin extends base_1.RspackBuiltinPlugin {
9
- constructor(chunkLoading, wasmLoading, module, workerPublicPath) {
9
+ constructor(chunkLoading, wasmLoading,
10
+ // @ts-expect-error not implemented
11
+ module,
12
+ // @ts-expect-error not implemented
13
+ workerPublicPath) {
10
14
  super();
11
15
  this.chunkLoading = chunkLoading;
12
16
  this.wasmLoading = wasmLoading;
@@ -22,7 +22,7 @@ function canInherentFromParent(affectedHooks) {
22
22
  exports.canInherentFromParent = canInherentFromParent;
23
23
  class RspackBuiltinPlugin {
24
24
  apply(compiler) {
25
- let raw = this.raw(compiler);
25
+ const raw = this.raw(compiler);
26
26
  if (raw) {
27
27
  raw.canInherentFromParent = canInherentFromParent(this.affectedHooks);
28
28
  compiler.__internal__registerBuiltinPlugin(raw);
@@ -53,7 +53,7 @@ const pitch = function (request, _, data) {
53
53
  this._module.type === "css/auto" ||
54
54
  this._module.type === "css/global" ||
55
55
  this._module.type === "css/module")) {
56
- let e = new Error(`use type 'css' and \`CssExtractRspackPlugin\` together, please set \`experiments.css\` to \`false\` or set \`{ type: "javascript/auto" }\` for rules with \`CssExtractRspackPlugin\` in your rspack config (now \`CssExtractRspackPlugin\` does nothing).`);
56
+ const e = new Error(`use type 'css' and \`CssExtractRspackPlugin\` together, please set \`experiments.css\` to \`false\` or set \`{ type: "javascript/auto" }\` for rules with \`CssExtractRspackPlugin\` in your rspack config (now \`CssExtractRspackPlugin\` does nothing).`);
57
57
  e.stack = undefined;
58
58
  this.emitWarning(e);
59
59
  return;
@@ -117,8 +117,8 @@ const pitch = function (request, _, data) {
117
117
  const identifierCountMap = new Map();
118
118
  dependencies = exports
119
119
  .map(([id, content, media, sourceMap, supports, layer]) => {
120
- let identifier = id;
121
- let context = this.rootContext;
120
+ const identifier = id;
121
+ const context = this.rootContext;
122
122
  const count = identifierCountMap.get(identifier) || 0;
123
123
  identifierCountMap.set(identifier, count + 1);
124
124
  return {