@rspack/core 1.0.0-alpha.5 → 1.0.0-beta.1

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 (181) hide show
  1. package/compiled/zod/index.d.ts +138 -52
  2. package/compiled/zod/index.js +300 -103
  3. package/compiled/zod/package.json +1 -1
  4. package/compiled/zod-validation-error/index.js +6 -6
  5. package/dist/Compilation.d.ts +22 -4
  6. package/dist/Compilation.js +64 -49
  7. package/dist/Compiler.d.ts +11 -10
  8. package/dist/Compiler.js +42 -42
  9. package/dist/ErrorHelpers.js +2 -4
  10. package/dist/Module.d.ts +1 -0
  11. package/dist/Module.js +3 -6
  12. package/dist/ModuleTypeConstants.d.ts +45 -69
  13. package/dist/ModuleTypeConstants.js +24 -77
  14. package/dist/NormalModule.d.ts +1 -0
  15. package/dist/NormalModule.js +1 -0
  16. package/dist/Stats.js +4 -6
  17. package/dist/Template.d.ts +31 -147
  18. package/dist/Template.js +40 -236
  19. package/dist/builtin-loader/lightningcss/index.d.ts +89 -0
  20. package/dist/builtin-loader/lightningcss/index.js +175 -0
  21. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/BannerPlugin.d.ts +25 -49
  26. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/DefinePlugin.js +9 -13
  34. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/EntryPlugin.d.ts +4 -3
  42. package/dist/builtin-plugin/EntryPlugin.js +1 -0
  43. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/ExternalsPlugin.d.ts +29 -5
  46. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +9 -9
  51. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
  55. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +4 -1
  59. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  65. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  66. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  67. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  68. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  70. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  71. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  72. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  73. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  74. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  75. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  76. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  78. package/dist/builtin-plugin/SplitChunksPlugin.js +5 -15
  79. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  81. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +15 -23
  82. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  83. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/base.d.ts +1 -1
  85. package/dist/builtin-plugin/base.js +1 -3
  86. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -3
  87. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +17 -66
  88. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +2 -0
  89. package/dist/builtin-plugin/css-extract/hmr/{normalize-url.js → normalizeUrl.js} +15 -24
  90. package/dist/builtin-plugin/css-extract/loader.d.ts +8 -3
  91. package/dist/builtin-plugin/css-extract/loader.js +28 -17
  92. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  93. package/dist/config/adapter.d.ts +1 -1
  94. package/dist/config/adapter.js +39 -25
  95. package/dist/config/adapterRuleUse.d.ts +5 -5
  96. package/dist/config/adapterRuleUse.js +23 -1
  97. package/dist/config/browserslistTargetHandler.d.ts +17 -15
  98. package/dist/config/browserslistTargetHandler.js +27 -33
  99. package/dist/config/defaults.js +27 -31
  100. package/dist/config/normalization.d.ts +8 -3
  101. package/dist/config/normalization.js +7 -5
  102. package/dist/config/target.d.ts +48 -109
  103. package/dist/config/target.js +50 -86
  104. package/dist/config/zod.d.ts +2660 -2305
  105. package/dist/config/zod.js +38 -19
  106. package/dist/container/ContainerPlugin.d.ts +7 -7
  107. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  108. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  109. package/dist/container/options.js +1 -1
  110. package/dist/exports.d.ts +4 -4
  111. package/dist/exports.js +2 -2
  112. package/dist/lib/AbstractMethodError.d.ts +12 -3
  113. package/dist/lib/AbstractMethodError.js +29 -21
  114. package/dist/lib/Cache.d.ts +40 -46
  115. package/dist/lib/Cache.js +43 -78
  116. package/dist/lib/CacheFacade.d.ts +119 -143
  117. package/dist/lib/CacheFacade.js +123 -123
  118. package/dist/lib/EntryOptionPlugin.d.ts +19 -2
  119. package/dist/lib/EntryOptionPlugin.js +22 -6
  120. package/dist/lib/EnvironmentPlugin.d.ts +17 -10
  121. package/dist/lib/EnvironmentPlugin.js +16 -15
  122. package/dist/lib/HookWebpackError.d.ts +27 -33
  123. package/dist/lib/HookWebpackError.js +33 -34
  124. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  125. package/dist/lib/{ignoreWarningsPlugin.js → IgnoreWarningsPlugin.js} +17 -0
  126. package/dist/lib/LoaderOptionsPlugin.d.ts +18 -9
  127. package/dist/lib/LoaderOptionsPlugin.js +38 -14
  128. package/dist/lib/LoaderTargetPlugin.d.ts +17 -8
  129. package/dist/lib/LoaderTargetPlugin.js +17 -15
  130. package/dist/lib/ModuleFilenameHelpers.d.ts +10 -1
  131. package/dist/lib/ModuleFilenameHelpers.js +10 -3
  132. package/dist/lib/NormalModuleReplacementPlugin.d.ts +15 -5
  133. package/dist/lib/NormalModuleReplacementPlugin.js +15 -5
  134. package/dist/lib/WebpackError.d.ts +29 -22
  135. package/dist/lib/WebpackError.js +17 -29
  136. package/dist/lib/cache/getLazyHashedEtag.d.ts +24 -24
  137. package/dist/lib/cache/getLazyHashedEtag.js +20 -23
  138. package/dist/lib/cache/mergeEtags.d.ts +15 -9
  139. package/dist/lib/cache/mergeEtags.js +23 -22
  140. package/dist/lib/formatLocation.d.ts +13 -8
  141. package/dist/lib/formatLocation.js +20 -20
  142. package/dist/loader-runner/LoaderLoadingError.d.ts +11 -1
  143. package/dist/loader-runner/LoaderLoadingError.js +3 -5
  144. package/dist/loader-runner/index.js +7 -9
  145. package/dist/loader-runner/loadLoader.d.ts +11 -2
  146. package/dist/loader-runner/loadLoader.js +17 -19
  147. package/dist/logging/createConsoleLogger.js +2 -6
  148. package/dist/logging/truncateArgs.js +5 -9
  149. package/dist/node/nodeConsole.js +1 -3
  150. package/dist/rspackOptionsApply.js +2 -2
  151. package/dist/stats/DefaultStatsFactoryPlugin.js +18 -8
  152. package/dist/stats/DefaultStatsPresetPlugin.js +4 -4
  153. package/dist/stats/DefaultStatsPrinterPlugin.js +11 -16
  154. package/dist/stats/StatsFactory.js +13 -17
  155. package/dist/stats/StatsPrinter.js +7 -9
  156. package/dist/util/AssetInfo.js +11 -7
  157. package/dist/util/SplitChunkSize.js +1 -1
  158. package/dist/util/cleverMerge.d.ts +33 -57
  159. package/dist/util/cleverMerge.js +89 -145
  160. package/dist/util/comparators.d.ts +1 -1
  161. package/dist/util/comparators.js +3 -5
  162. package/dist/util/createHash.d.ts +4 -3
  163. package/dist/util/createHash.js +31 -45
  164. package/dist/util/fs.js +9 -13
  165. package/dist/util/hash/BatchedHash.d.ts +24 -9
  166. package/dist/util/hash/BatchedHash.js +16 -13
  167. package/dist/util/hash/index.d.ts +9 -9
  168. package/dist/util/hash/index.js +14 -11
  169. package/dist/util/hash/md4.d.ts +29 -2
  170. package/dist/util/hash/md4.js +7 -3
  171. package/dist/util/hash/wasm-hash.d.ts +52 -5
  172. package/dist/util/hash/wasm-hash.js +19 -22
  173. package/dist/util/hash/xxhash64.d.ts +29 -2
  174. package/dist/util/hash/xxhash64.js +7 -3
  175. package/dist/util/identifier.js +9 -15
  176. package/dist/util/index.js +1 -1
  177. package/dist/util/memoize.js +7 -9
  178. package/package.json +9 -8
  179. package/compiled/enhanced-resolve/index.js +0 -5566
  180. package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
  181. package/dist/lib/ignoreWarningsPlugin.d.ts +0 -7
@@ -1,21 +1,20 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
1
  "use strict";
6
- const createHash = require("../../util/createHash");
7
- // /** @typedef {import("../util/Hash")} Hash */
8
- // /** @typedef {typeof import("../util/Hash")} HashConstructor */
9
- /** @typedef {any} Hash */
10
- /** @typedef {any} HashConstructor */
11
2
  /**
12
- * @typedef {Object} HashableObject
13
- * @property {function(Hash): void} updateHash
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/getLazyHashedEtag.js
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack/blob/main/LICENSE
14
10
  */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getter = void 0;
13
+ const createHash_1 = require("../../util/createHash");
15
14
  class LazyHashedEtag {
16
15
  /**
17
- * @param {HashableObject} obj object with updateHash method
18
- * @param {string | HashConstructor} hashFunction the hash function to use
16
+ * @param obj object with updateHash method
17
+ * @param hashFunction the hash function to use
19
18
  */
20
19
  constructor(obj, hashFunction = "md4") {
21
20
  this._obj = obj;
@@ -23,26 +22,23 @@ class LazyHashedEtag {
23
22
  this._hashFunction = hashFunction;
24
23
  }
25
24
  /**
26
- * @returns {string} hash of object
25
+ * @returns hash of object
27
26
  */
28
27
  toString() {
29
28
  if (this._hash === undefined) {
30
- // @ts-expect-error
31
- const hash = createHash(this._hashFunction);
29
+ const hash = (0, createHash_1.createHash)(this._hashFunction);
32
30
  this._obj.updateHash(hash);
33
- this._hash = /** @type {string} */ (hash.digest("base64"));
31
+ this._hash = hash.digest("base64");
34
32
  }
35
33
  return this._hash;
36
34
  }
37
35
  }
38
- /** @type {Map<string | HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
39
36
  const mapStrings = new Map();
40
- /** @type {WeakMap<HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
41
37
  const mapObjects = new WeakMap();
42
38
  /**
43
- * @param {HashableObject} obj object with updateHash method
44
- * @param {string | HashConstructor} hashFunction the hash function to use
45
- * @returns {LazyHashedEtag} etag
39
+ * @param obj object with updateHash method
40
+ * @param ashFunction the hash function to use
41
+ * @returns etag
46
42
  */
47
43
  const getter = (obj, hashFunction = "md4") => {
48
44
  let innerMap;
@@ -73,4 +69,5 @@ const getter = (obj, hashFunction = "md4") => {
73
69
  innerMap.set(obj, newHash);
74
70
  return newHash;
75
71
  };
76
- module.exports = getter;
72
+ exports.getter = getter;
73
+ exports.default = exports.getter;
@@ -1,11 +1,17 @@
1
- export = mergeEtags;
2
1
  /**
3
- * @param {Etag} a first
4
- * @param {Etag} b second
5
- * @returns {Etag} result
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.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
6
9
  */
7
- declare function mergeEtags(a: Etag, b: Etag): Etag;
8
- declare namespace mergeEtags {
9
- export { Etag };
10
- }
11
- type Etag = import("../Cache").Etag;
10
+ import type { Etag } from "../Cache";
11
+ /**
12
+ * @param a first
13
+ * @param b second
14
+ * @returns result
15
+ */
16
+ export declare const mergeEtags: (a: Etag, b: Etag) => Etag;
17
+ export default mergeEtags;
@@ -1,13 +1,19 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
1
  "use strict";
6
- /** @typedef {import("../Cache").Etag} Etag */
2
+ /**
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.js
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack/blob/main/LICENSE
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.mergeEtags = void 0;
7
13
  class MergedEtag {
8
14
  /**
9
- * @param {Etag} a first
10
- * @param {Etag} b second
15
+ * @param a first
16
+ * @param b second
11
17
  */
12
18
  constructor(a, b) {
13
19
  this.a = a;
@@ -20,20 +26,18 @@ class MergedEtag {
20
26
  const dualObjectMap = new WeakMap();
21
27
  const objectStringMap = new WeakMap();
22
28
  /**
23
- * @param {Etag} a first
24
- * @param {Etag} b second
25
- * @returns {Etag} result
29
+ * @param a first
30
+ * @param b second
31
+ * @returns result
26
32
  */
27
33
  const mergeEtags = (a, b) => {
28
34
  if (typeof a === "string") {
29
35
  if (typeof b === "string") {
30
36
  return `${a}|${b}`;
31
37
  }
32
- else {
33
- const temp = b;
34
- b = a;
35
- a = temp;
36
- }
38
+ const temp = b;
39
+ b = a;
40
+ a = temp;
37
41
  }
38
42
  else {
39
43
  if (typeof b !== "string") {
@@ -48,9 +52,7 @@ const mergeEtags = (a, b) => {
48
52
  map.set(b, newMergedEtag);
49
53
  return newMergedEtag;
50
54
  }
51
- else {
52
- return mergedEtag;
53
- }
55
+ return mergedEtag;
54
56
  }
55
57
  }
56
58
  // a is object, b is string
@@ -64,8 +66,7 @@ const mergeEtags = (a, b) => {
64
66
  map.set(b, newMergedEtag);
65
67
  return newMergedEtag;
66
68
  }
67
- else {
68
- return mergedEtag;
69
- }
69
+ return mergedEtag;
70
70
  };
71
- module.exports = mergeEtags;
71
+ exports.mergeEtags = mergeEtags;
72
+ exports.default = exports.mergeEtags;
@@ -1,11 +1,16 @@
1
- export = formatLocation;
2
1
  /**
3
- * @param {DependencyLocation} loc location
4
- * @returns {string} formatted location
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/formatLocation.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
5
9
  */
6
- declare function formatLocation(loc: DependencyLocation): string;
7
- declare namespace formatLocation {
8
- export { DependencyLocation, SourcePosition };
9
- }
10
10
  type DependencyLocation = any;
11
- type SourcePosition = any;
11
+ /**
12
+ * @param loc location
13
+ * @returns formatted location
14
+ */
15
+ declare const formatLocation: (loc: DependencyLocation) => string;
16
+ export default formatLocation;
@@ -1,32 +1,34 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
1
  "use strict";
6
- // /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
7
- // /** @typedef {import("./Dependency").SourcePosition} SourcePosition */
8
- /** @typedef {any} DependencyLocation */
9
- /** @typedef {any} SourcePosition */
10
2
  /**
11
- * @param {SourcePosition} pos position
12
- * @returns {string} formatted position
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/formatLocation.js
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack/blob/main/LICENSE
13
10
  */
14
- const formatPosition = pos => {
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**
13
+ * @param pos position
14
+ * @returns formatted position
15
+ */
16
+ const formatPosition = (pos) => {
15
17
  if (pos && typeof pos === "object") {
16
18
  if ("line" in pos && "column" in pos) {
17
19
  return `${pos.line}:${pos.column}`;
18
20
  }
19
- else if ("line" in pos) {
21
+ if ("line" in pos) {
20
22
  return `${pos.line}:?`;
21
23
  }
22
24
  }
23
25
  return "";
24
26
  };
25
27
  /**
26
- * @param {DependencyLocation} loc location
27
- * @returns {string} formatted location
28
+ * @param loc location
29
+ * @returns formatted location
28
30
  */
29
- const formatLocation = loc => {
31
+ const formatLocation = (loc) => {
30
32
  if (loc && typeof loc === "object") {
31
33
  if ("start" in loc && loc.start && "end" in loc && loc.end) {
32
34
  if (typeof loc.start === "object" &&
@@ -37,7 +39,7 @@ const formatLocation = loc => {
37
39
  loc.start.line === loc.end.line) {
38
40
  return `${formatPosition(loc.start)}-${loc.end.column}`;
39
41
  }
40
- else if (typeof loc.start === "object" &&
42
+ if (typeof loc.start === "object" &&
41
43
  typeof loc.start.line === "number" &&
42
44
  typeof loc.start.column !== "number" &&
43
45
  typeof loc.end === "object" &&
@@ -45,9 +47,7 @@ const formatLocation = loc => {
45
47
  typeof loc.end.column !== "number") {
46
48
  return `${loc.start.line}-${loc.end.line}`;
47
49
  }
48
- else {
49
- return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
50
- }
50
+ return `${formatPosition(loc.start)}-${formatPosition(loc.end)}`;
51
51
  }
52
52
  if ("start" in loc && loc.start) {
53
53
  return formatPosition(loc.start);
@@ -61,4 +61,4 @@ const formatLocation = loc => {
61
61
  }
62
62
  return "";
63
63
  };
64
- module.exports = formatLocation;
64
+ exports.default = formatLocation;
@@ -1,3 +1,13 @@
1
- export = LoadingLoaderError;
1
+ /**
2
+ * The following code is from
3
+ * https://github.com/webpack/loader-runner
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/loader-runner/blob/main/LICENSE
9
+ */
2
10
  declare class LoadingLoaderError extends Error {
11
+ constructor(message: string);
3
12
  }
13
+ export default LoadingLoaderError;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * The following code is from
3
4
  * https://github.com/webpack/loader-runner
@@ -7,15 +8,12 @@
7
8
  * Copyright (c) JS Foundation and other contributors
8
9
  * https://github.com/webpack/loader-runner/blob/main/LICENSE
9
10
  */
10
- "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
11
12
  class LoadingLoaderError extends Error {
12
- /**
13
- * @param {string=} message
14
- */
15
13
  constructor(message) {
16
14
  super(message);
17
15
  this.name = "LoaderRunnerError";
18
16
  Error.captureStackTrace(this, this.constructor);
19
17
  }
20
18
  }
21
- module.exports = LoadingLoaderError;
19
+ exports.default = LoadingLoaderError;
@@ -293,7 +293,6 @@ async function runLoaders(compiler, context) {
293
293
  const contextDependencies = context.contextDependencies;
294
294
  const missingDependencies = context.missingDependencies;
295
295
  const buildDependencies = context.buildDependencies;
296
- const assetFilenames = context.assetFilenames;
297
296
  /// Construct `loaderContext`
298
297
  const loaderContext = {};
299
298
  loaderContext.loaders = context.loaderItems.map(item => {
@@ -356,7 +355,6 @@ async function runLoaders(compiler, context) {
356
355
  if (res.cacheable === false) {
357
356
  this.cacheable(false);
358
357
  }
359
- assetFilenames.push(...res.assets);
360
358
  resolve(compiler.__internal__getModuleExecutionResult(res.id));
361
359
  }
362
360
  });
@@ -384,7 +382,6 @@ async function runLoaders(compiler, context) {
384
382
  if (res.cacheable === false) {
385
383
  this.cacheable(false);
386
384
  }
387
- assetFilenames.push(...res.assets);
388
385
  callback(undefined, compiler.__internal__getModuleExecutionResult(res.id));
389
386
  }
390
387
  });
@@ -560,9 +557,12 @@ async function runLoaders(compiler, context) {
560
557
  // @ts-expect-error webpack-sources type declaration is wrong
561
558
  content);
562
559
  }
563
- assetFilenames.push(name),
564
- // @ts-expect-error
565
- compiler._lastCompilation.emitAsset(name, source, assetInfo);
560
+ // @ts-expect-error
561
+ compiler._lastCompilation.__internal__emit_asset_from_loader(name,
562
+ // @ts-expect-error
563
+ source,
564
+ // @ts-expect-error
565
+ assetInfo, context._moduleIdentifier);
566
566
  };
567
567
  loaderContext.fs = compiler.inputFileSystem;
568
568
  const getAbsolutify = (0, memoize_1.memoize)(() => identifier_1.absolutify.bindCache(compiler.root));
@@ -709,9 +709,7 @@ function utf8BufferToString(buf) {
709
709
  if (str.charCodeAt(0) === 0xfeff) {
710
710
  return str.slice(1);
711
711
  }
712
- else {
713
- return str;
714
- }
712
+ return str;
715
713
  }
716
714
  function convertArgs(args, raw) {
717
715
  if (!raw && Buffer.isBuffer(args[0]))
@@ -1,2 +1,11 @@
1
- declare function _exports(loader: any, callback: any): any;
2
- export = _exports;
1
+ /**
2
+ * The following code is from
3
+ * https://github.com/webpack/loader-runner
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/loader-runner/blob/main/LICENSE
9
+ */
10
+ import type { LoaderObject } from ".";
11
+ export default function loadLoader(loader: LoaderObject, callback: (err: unknown) => void): void;
@@ -8,19 +8,20 @@
8
8
  * Copyright (c) JS Foundation and other contributors
9
9
  * https://github.com/webpack/loader-runner/blob/main/LICENSE
10
10
  */
11
- var LoaderLoadingError = require("./LoaderLoadingError");
12
- /** @type {undefined | import('node:url')} */
13
- var url;
14
- // @ts-expect-error
15
- module.exports = function loadLoader(loader, callback) {
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const LoaderLoadingError_1 = __importDefault(require("./LoaderLoadingError"));
16
+ var url = undefined;
17
+ function loadLoader(loader, callback) {
16
18
  if (loader.type === "module") {
17
19
  try {
18
20
  if (url === undefined)
19
21
  url = require("node:url");
20
22
  var loaderUrl = url.pathToFileURL(loader.path);
21
- /** @type {Promise<any>} */
22
23
  var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
23
- modulePromise.then(module => {
24
+ modulePromise.then((module) => {
24
25
  handleResult(loader, module, callback);
25
26
  }, callback);
26
27
  return;
@@ -36,28 +37,25 @@ module.exports = function loadLoader(loader, callback) {
36
37
  catch (e) {
37
38
  // it is possible for node to choke on a require if the FD descriptor
38
39
  // limit has been reached. give it a chance to recover.
39
- // @ts-expect-error
40
- if (e instanceof Error && e.code === "EMFILE") {
41
- // @ts-expect-error
40
+ if (e instanceof Error &&
41
+ e.code === "EMFILE") {
42
42
  var retry = loadLoader.bind(null, loader, callback);
43
43
  if (typeof setImmediate === "function") {
44
44
  // node >= 0.9.0
45
- return setImmediate(retry);
46
- }
47
- else {
48
- // node < 0.9.0
49
- return process.nextTick(retry);
45
+ return void setImmediate(retry);
50
46
  }
47
+ // node < 0.9.0
48
+ return process.nextTick(retry);
51
49
  }
52
50
  return callback(e);
53
51
  }
54
52
  return handleResult(loader, module, callback);
55
53
  }
56
- };
57
- // @ts-expect-error
54
+ }
55
+ exports.default = loadLoader;
58
56
  function handleResult(loader, module, callback) {
59
57
  if (typeof module !== "function" && typeof module !== "object") {
60
- return callback(new LoaderLoadingError("Module '" +
58
+ return callback(new LoaderLoadingError_1.default("Module '" +
61
59
  loader.path +
62
60
  "' is not a loader (export function or es6 module)"));
63
61
  }
@@ -66,7 +64,7 @@ function handleResult(loader, module, callback) {
66
64
  loader.raw = module.raw;
67
65
  if (typeof loader.normal !== "function" &&
68
66
  typeof loader.pitch !== "function") {
69
- return callback(new LoaderLoadingError("Module '" +
67
+ return callback(new LoaderLoadingError_1.default("Module '" +
70
68
  loader.path +
71
69
  "' is not a loader (must have normal or pitch function)"));
72
70
  }
@@ -87,13 +87,9 @@ module.exports = ({ level = "info", debug = false, console }) => {
87
87
  if (args.length > 0 && typeof args[0] === "string") {
88
88
  return [`[${name}] ${args[0]}`, ...args.slice(1)];
89
89
  }
90
- else {
91
- return [`[${name}]`, ...args];
92
- }
93
- }
94
- else {
95
- return [];
90
+ return [`[${name}]`, ...args];
96
91
  }
92
+ return [];
97
93
  };
98
94
  const debug = debugFilters.some(f => f(name));
99
95
  switch (type) {
@@ -30,12 +30,10 @@ const truncateArgs = (args, maxLength) => {
30
30
  if (availableLength >= args[0].length) {
31
31
  return args;
32
32
  }
33
- else if (availableLength > 3) {
33
+ if (availableLength > 3) {
34
34
  return ["..." + args[0].slice(-availableLength + 3)];
35
35
  }
36
- else {
37
- return [args[0].slice(-availableLength)];
38
- }
36
+ return [args[0].slice(-availableLength)];
39
37
  }
40
38
  // Check if there is space for at least 4 chars per arg
41
39
  // @ts-expect-error
@@ -76,15 +74,13 @@ const truncateArgs = (args, maxLength) => {
76
74
  if (str.length === length) {
77
75
  return str;
78
76
  }
79
- else if (length > 5) {
77
+ if (length > 5) {
80
78
  return "..." + str.slice(-length + 3);
81
79
  }
82
- else if (length > 0) {
80
+ if (length > 0) {
83
81
  return str.slice(-length);
84
82
  }
85
- else {
86
- return "";
87
- }
83
+ return "";
88
84
  });
89
85
  };
90
86
  exports.truncateArgs = truncateArgs;
@@ -50,9 +50,7 @@ module.exports = ({ colors, appendOnly, stream }) => {
50
50
  str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) +
51
51
  colorSuffix);
52
52
  }
53
- else {
54
- return prefix + str.replace(/\n/g, "\n" + prefix);
55
- }
53
+ return prefix + str.replace(/\n/g, "\n" + prefix);
56
54
  };
57
55
  const clearStatusMessage = () => {
58
56
  if (hasStatusMessage) {
@@ -18,7 +18,7 @@ const graceful_fs_1 = __importDefault(require("../compiled/graceful-fs"));
18
18
  const Module_1 = require("./Module");
19
19
  const builtin_plugin_1 = require("./builtin-plugin");
20
20
  const EntryOptionPlugin_1 = __importDefault(require("./lib/EntryOptionPlugin"));
21
- const ignoreWarningsPlugin_1 = __importDefault(require("./lib/ignoreWarningsPlugin"));
21
+ const IgnoreWarningsPlugin_1 = __importDefault(require("./lib/IgnoreWarningsPlugin"));
22
22
  const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin");
23
23
  const DefaultStatsPresetPlugin_1 = require("./stats/DefaultStatsPresetPlugin");
24
24
  const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");
@@ -258,7 +258,7 @@ class RspackOptionsApply {
258
258
  new DefaultStatsPresetPlugin_1.DefaultStatsPresetPlugin().apply(compiler);
259
259
  new DefaultStatsPrinterPlugin_1.DefaultStatsPrinterPlugin().apply(compiler);
260
260
  if (options.ignoreWarnings && options.ignoreWarnings.length > 0) {
261
- new ignoreWarningsPlugin_1.default(options.ignoreWarnings).apply(compiler);
261
+ new IgnoreWarningsPlugin_1.default(options.ignoreWarnings).apply(compiler);
262
262
  }
263
263
  compiler.hooks.afterPlugins.call(compiler);
264
264
  if (!compiler.inputFileSystem) {
@@ -261,7 +261,7 @@ const MODULES_GROUPERS = (type) => ({
261
261
  if (groupModulesByType) {
262
262
  return [module.moduleType.split("/", 1)[0]];
263
263
  }
264
- else if (module.moduleType === "runtime") {
264
+ if (module.moduleType === "runtime") {
265
265
  return ["runtime"];
266
266
  }
267
267
  },
@@ -395,16 +395,21 @@ const RESULT_SORTERS = {
395
395
  "compilation.assets": ASSET_SORTERS,
396
396
  "asset.related": ASSET_SORTERS
397
397
  };
398
+ const MODULES_SORTER = {
399
+ _: comparators => {
400
+ comparators.push((0, comparators_1.compareSelect)((m) => m.depth, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.preOrderIndex, comparators_1.compareNumbers), (0, comparators_1.compareSelect)((m) => m.identifier, compareIds));
401
+ }
402
+ };
398
403
  const SORTERS = {
399
404
  "compilation.chunks": {
400
405
  _: comparators => {
401
406
  comparators.push((0, comparators_1.compareSelect)((c) => c.id, compareIds));
402
407
  }
403
408
  },
404
- // "compilation.modules": MODULES_SORTER,
405
- // "chunk.rootModules": MODULES_SORTER,
406
- // "chunk.modules": MODULES_SORTER,
407
- // "module.modules": MODULES_SORTER,
409
+ "compilation.modules": MODULES_SORTER,
410
+ "chunk.rootModules": MODULES_SORTER,
411
+ "chunk.modules": MODULES_SORTER,
412
+ "module.modules": MODULES_SORTER,
408
413
  // not support module.reasons (missing Module.identifier())
409
414
  "chunk.origins": {
410
415
  _: comparators => {
@@ -665,7 +670,7 @@ const SIMPLE_EXTRACTORS = {
665
670
  // compilationFileToChunks
666
671
  // compilationAuxiliaryFileToChunks
667
672
  });
668
- const limited = (0, statsFactoryUtils_1.spaceLimited)(groupedAssets, options.assetsSpace || Number.POSITIVE_INFINITY);
673
+ const limited = (0, statsFactoryUtils_1.spaceLimited)(groupedAssets, options.assetsSpace ?? Number.POSITIVE_INFINITY);
669
674
  object.assets = limited.children;
670
675
  object.filteredAssets = limited.filteredChildren;
671
676
  },
@@ -805,9 +810,14 @@ const SIMPLE_EXTRACTORS = {
805
810
  const { type } = context;
806
811
  object.type = module.type;
807
812
  object.moduleType = module.moduleType;
808
- // TODO: object.layer = module.layer;
813
+ object.layer = module.layer;
809
814
  object.size = module.size;
810
- object.sizes = Object.fromEntries(module.sizes.map(({ sourceType, size }) => [sourceType, size]));
815
+ const sizes = module.sizes.map(({ sourceType, size }) => [
816
+ sourceType,
817
+ size
818
+ ]);
819
+ sizes.sort((a, b) => -compareIds(a, b));
820
+ object.sizes = Object.fromEntries(sizes);
811
821
  object.built = module.built;
812
822
  object.codeGenerated = module.codeGenerated;
813
823
  object.buildTimeExecuted = module.buildTimeExecuted;
@@ -43,7 +43,7 @@ const NAMED_PRESETS = {
43
43
  // warningsSpace: Infinity,
44
44
  modulesSpace: Number.POSITIVE_INFINITY,
45
45
  // chunkModulesSpace: Infinity,
46
- // assetsSpace: Infinity,
46
+ assetsSpace: Number.POSITIVE_INFINITY,
47
47
  // reasonsSpace: Infinity,
48
48
  children: true
49
49
  },
@@ -69,8 +69,8 @@ const NAMED_PRESETS = {
69
69
  // exclude: false,
70
70
  // errorsSpace: 1000,
71
71
  // warningsSpace: 1000,
72
- modulesSpace: 1000
73
- // assetsSpace: 1000,
72
+ modulesSpace: 1000,
73
+ assetsSpace: 1000
74
74
  // reasonsSpace: 1000
75
75
  },
76
76
  minimal: {
@@ -82,7 +82,7 @@ const NAMED_PRESETS = {
82
82
  // warningsSpace: 0,
83
83
  modulesSpace: 0,
84
84
  assets: true,
85
- // assetsSpace: 0,
85
+ assetsSpace: 0,
86
86
  errors: true,
87
87
  errorsCount: true,
88
88
  warnings: true,