@rspack/core 1.0.0-beta.0 → 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 (115) hide show
  1. package/dist/Compilation.d.ts +1 -1
  2. package/dist/Compiler.d.ts +11 -10
  3. package/dist/Compiler.js +14 -14
  4. package/dist/Module.d.ts +1 -0
  5. package/dist/Module.js +1 -0
  6. package/dist/NormalModule.d.ts +1 -0
  7. package/dist/NormalModule.js +1 -0
  8. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  9. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  10. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  11. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/BannerPlugin.d.ts +31 -31
  13. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/EntryPlugin.d.ts +3 -2
  28. package/dist/builtin-plugin/EntryPlugin.js +1 -0
  29. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/ExternalsPlugin.d.ts +5 -5
  32. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +9 -9
  37. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  39. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  40. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -11
  43. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  65. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
  66. package/dist/builtin-plugin/base.d.ts +1 -1
  67. package/dist/builtin-plugin/css-extract/loader.d.ts +8 -3
  68. package/dist/builtin-plugin/css-extract/loader.js +24 -13
  69. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
  70. package/dist/config/adapter.js +15 -2
  71. package/dist/config/adapterRuleUse.js +3 -3
  72. package/dist/config/defaults.js +7 -10
  73. package/dist/config/normalization.d.ts +6 -3
  74. package/dist/config/normalization.js +2 -0
  75. package/dist/config/zod.d.ts +1224 -1055
  76. package/dist/config/zod.js +10 -1
  77. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  78. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  79. package/dist/exports.d.ts +1 -1
  80. package/dist/lib/AbstractMethodError.d.ts +12 -3
  81. package/dist/lib/AbstractMethodError.js +29 -21
  82. package/dist/lib/Cache.d.ts +40 -46
  83. package/dist/lib/Cache.js +43 -78
  84. package/dist/lib/CacheFacade.d.ts +119 -143
  85. package/dist/lib/CacheFacade.js +123 -124
  86. package/dist/lib/EntryOptionPlugin.d.ts +19 -2
  87. package/dist/lib/EntryOptionPlugin.js +22 -6
  88. package/dist/lib/EnvironmentPlugin.d.ts +17 -10
  89. package/dist/lib/EnvironmentPlugin.js +16 -15
  90. package/dist/lib/HookWebpackError.d.ts +27 -33
  91. package/dist/lib/HookWebpackError.js +33 -34
  92. package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
  93. package/dist/lib/{ignoreWarningsPlugin.js → IgnoreWarningsPlugin.js} +17 -0
  94. package/dist/lib/LoaderOptionsPlugin.d.ts +18 -9
  95. package/dist/lib/LoaderOptionsPlugin.js +38 -14
  96. package/dist/lib/LoaderTargetPlugin.d.ts +17 -8
  97. package/dist/lib/LoaderTargetPlugin.js +17 -15
  98. package/dist/lib/ModuleFilenameHelpers.d.ts +10 -1
  99. package/dist/lib/ModuleFilenameHelpers.js +9 -0
  100. package/dist/lib/NormalModuleReplacementPlugin.d.ts +15 -5
  101. package/dist/lib/NormalModuleReplacementPlugin.js +15 -5
  102. package/dist/lib/WebpackError.d.ts +29 -22
  103. package/dist/lib/WebpackError.js +17 -29
  104. package/dist/lib/cache/getLazyHashedEtag.d.ts +24 -24
  105. package/dist/lib/cache/getLazyHashedEtag.js +20 -23
  106. package/dist/lib/cache/mergeEtags.d.ts +15 -9
  107. package/dist/lib/cache/mergeEtags.js +18 -11
  108. package/dist/lib/formatLocation.d.ts +13 -8
  109. package/dist/lib/formatLocation.js +17 -15
  110. package/dist/rspackOptionsApply.js +2 -2
  111. package/dist/stats/DefaultStatsFactoryPlugin.js +1 -1
  112. package/dist/util/comparators.d.ts +1 -1
  113. package/package.json +3 -3
  114. package/compiled/enhanced-resolve/index.js +0 -5566
  115. 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,9 +26,9 @@ 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") {
@@ -62,4 +68,5 @@ const mergeEtags = (a, b) => {
62
68
  }
63
69
  return mergedEtag;
64
70
  };
65
- 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,17 +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("./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}`;
@@ -23,10 +25,10 @@ const formatPosition = pos => {
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" &&
@@ -59,4 +61,4 @@ const formatLocation = loc => {
59
61
  }
60
62
  return "";
61
63
  };
62
- module.exports = formatLocation;
64
+ exports.default = formatLocation;
@@ -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) {
@@ -810,7 +810,7 @@ const SIMPLE_EXTRACTORS = {
810
810
  const { type } = context;
811
811
  object.type = module.type;
812
812
  object.moduleType = module.moduleType;
813
- // TODO: object.layer = module.layer;
813
+ object.layer = module.layer;
814
814
  object.size = module.size;
815
815
  const sizes = module.sizes.map(({ sourceType, size }) => [
816
816
  sourceType,
@@ -16,5 +16,5 @@ export declare const compareIds: (a: string | number, b: string | number) => -1
16
16
  export declare const compareChunksById: (a: Chunk, b: Chunk) => -1 | 0 | 1;
17
17
  export declare const compareChunkGroupsByIndex: (a: ChunkGroup, b: ChunkGroup) => -1 | 0 | 1;
18
18
  export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
19
- export declare const compareNumbers: (a: number, b: number) => 0 | 1 | -1;
19
+ export declare const compareNumbers: (a: number, b: number) => 1 | 0 | -1;
20
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -59,8 +59,8 @@
59
59
  "dependencies": {
60
60
  "@module-federation/runtime-tools": "0.2.3",
61
61
  "caniuse-lite": "^1.0.30001616",
62
- "@rspack/binding": "1.0.0-beta.0",
63
- "@rspack/lite-tapable": "1.0.0-beta.0"
62
+ "@rspack/lite-tapable": "1.0.0-beta.1",
63
+ "@rspack/binding": "1.0.0-beta.1"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@swc/helpers": ">=0.5.1"