@rspack/core 1.0.0-alpha.4 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) 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 +21 -3
  6. package/dist/Compilation.js +64 -49
  7. package/dist/Compiler.js +28 -28
  8. package/dist/ErrorHelpers.js +2 -4
  9. package/dist/FileSystem.js +6 -6
  10. package/dist/Module.js +2 -6
  11. package/dist/ModuleTypeConstants.d.ts +45 -69
  12. package/dist/ModuleTypeConstants.js +24 -77
  13. package/dist/NormalModule.js +6 -6
  14. package/dist/Stats.js +4 -6
  15. package/dist/Template.d.ts +31 -147
  16. package/dist/Template.js +40 -236
  17. package/dist/Watching.js +2 -2
  18. package/dist/builtin-loader/lightningcss/index.d.ts +89 -0
  19. package/dist/builtin-loader/lightningcss/index.js +175 -0
  20. package/dist/builtin-plugin/BannerPlugin.d.ts +24 -48
  21. package/dist/builtin-plugin/DefinePlugin.js +9 -13
  22. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  23. package/dist/builtin-plugin/ExternalsPlugin.d.ts +24 -0
  24. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +8 -8
  25. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
  26. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +10 -3
  27. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +4 -1
  28. package/dist/builtin-plugin/SplitChunksPlugin.js +7 -17
  29. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +15 -23
  30. package/dist/builtin-plugin/base.js +1 -3
  31. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -3
  32. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +17 -66
  33. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +2 -0
  34. package/dist/builtin-plugin/css-extract/hmr/{normalize-url.js → normalizeUrl.js} +15 -24
  35. package/dist/builtin-plugin/css-extract/loader.js +6 -6
  36. package/dist/builtin-plugin/css-extract/utils.js +3 -3
  37. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +3 -3
  38. package/dist/builtin-plugin/lazy-compilation/backend.js +1 -1
  39. package/dist/config/adapter.d.ts +1 -1
  40. package/dist/config/adapter.js +31 -30
  41. package/dist/config/adapterRuleUse.d.ts +5 -5
  42. package/dist/config/adapterRuleUse.js +23 -1
  43. package/dist/config/browserslistTargetHandler.d.ts +17 -15
  44. package/dist/config/browserslistTargetHandler.js +27 -33
  45. package/dist/config/defaults.js +27 -28
  46. package/dist/config/normalization.d.ts +2 -0
  47. package/dist/config/normalization.js +5 -5
  48. package/dist/config/target.d.ts +48 -109
  49. package/dist/config/target.js +50 -86
  50. package/dist/config/zod.d.ts +2398 -2212
  51. package/dist/config/zod.js +29 -19
  52. package/dist/container/ContainerPlugin.d.ts +7 -7
  53. package/dist/container/options.js +1 -1
  54. package/dist/exports.d.ts +4 -4
  55. package/dist/exports.js +2 -2
  56. package/dist/lib/CacheFacade.js +1 -0
  57. package/dist/lib/EntryOptionPlugin.js +2 -2
  58. package/dist/lib/ModuleFilenameHelpers.js +1 -3
  59. package/dist/lib/WebpackError.js +1 -1
  60. package/dist/lib/cache/mergeEtags.js +5 -11
  61. package/dist/lib/formatLocation.js +3 -5
  62. package/dist/loader-runner/LoaderLoadingError.d.ts +11 -1
  63. package/dist/loader-runner/LoaderLoadingError.js +3 -5
  64. package/dist/loader-runner/index.js +23 -25
  65. package/dist/loader-runner/loadLoader.d.ts +11 -2
  66. package/dist/loader-runner/loadLoader.js +18 -20
  67. package/dist/logging/createConsoleLogger.js +2 -6
  68. package/dist/logging/truncateArgs.js +5 -9
  69. package/dist/node/NodeWatchFileSystem.js +5 -5
  70. package/dist/node/nodeConsole.js +2 -4
  71. package/dist/rspack.js +6 -6
  72. package/dist/rspackOptionsApply.js +3 -3
  73. package/dist/stats/DefaultStatsFactoryPlugin.js +65 -20
  74. package/dist/stats/DefaultStatsPresetPlugin.js +4 -4
  75. package/dist/stats/DefaultStatsPrinterPlugin.js +12 -17
  76. package/dist/stats/StatsFactory.js +13 -17
  77. package/dist/stats/StatsPrinter.js +7 -9
  78. package/dist/stats/statsFactoryUtils.d.ts +9 -10
  79. package/dist/util/AssetInfo.js +11 -7
  80. package/dist/util/SplitChunkSize.js +1 -1
  81. package/dist/util/bindingVersionCheck.js +6 -6
  82. package/dist/util/cleverMerge.d.ts +33 -57
  83. package/dist/util/cleverMerge.js +89 -145
  84. package/dist/util/comparators.js +3 -5
  85. package/dist/util/createHash.d.ts +4 -3
  86. package/dist/util/createHash.js +31 -45
  87. package/dist/util/fs.js +16 -20
  88. package/dist/util/hash/BatchedHash.d.ts +24 -9
  89. package/dist/util/hash/BatchedHash.js +16 -13
  90. package/dist/util/hash/index.d.ts +9 -9
  91. package/dist/util/hash/index.js +14 -11
  92. package/dist/util/hash/md4.d.ts +29 -2
  93. package/dist/util/hash/md4.js +7 -3
  94. package/dist/util/hash/wasm-hash.d.ts +52 -5
  95. package/dist/util/hash/wasm-hash.js +19 -22
  96. package/dist/util/hash/xxhash64.d.ts +29 -2
  97. package/dist/util/hash/xxhash64.js +7 -3
  98. package/dist/util/identifier.js +13 -19
  99. package/dist/util/index.js +1 -1
  100. package/dist/util/memoize.js +7 -9
  101. package/package.json +9 -8
  102. package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
@@ -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/util/hash/xxhash64.js
@@ -7,11 +8,14 @@
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
- const create = require("./wasm-hash");
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 wasm_hash_1 = __importDefault(require("./wasm-hash"));
12
16
  //#region wasm code: xxhash64 (../../../assembly/hash/xxhash64.asm.ts) --initialMemory 1
13
17
  const xxhash64 = new WebAssembly.Module(Buffer.from(
14
18
  // 1170 bytes
15
19
  "AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMBIQMjAiEEIwMhBQNAIAIgASkDAELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiECIAMgASkDCELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEDIAQgASkDEELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEEIAUgASkDGELP1tO+0ser2UJ+fEIfiUKHla+vmLbem55/fiEFIAAgAUEgaiIBSw0ACyACJAAgAyQBIAQkAiAFJAMLqAYCAX8EfiMEQgBSBH4jACICQgGJIwEiA0IHiXwjAiIEQgyJfCMDIgVCEol8IAJCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0gA0LP1tO+0ser2UJ+Qh+JQoeVr6+Ytt6bnn9+hUKHla+vmLbem55/fkKdo7Xqg7GNivoAfSAEQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IAVCz9bTvtLHq9lCfkIfiUKHla+vmLbem55/foVCh5Wvr5i23puef35CnaO16oOxjYr6AH0FQsXP2bLx5brqJwsjBCAArXx8IQIDQCABQQhqIABNBEAgAiABKQMAQs/W077Sx6vZQn5CH4lCh5Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL", "base64"));
16
20
  //#endregion
17
- module.exports = create.bind(null, xxhash64, [], 32, 16);
21
+ exports.default = wasm_hash_1.default.bind(null, xxhash64, [], 32, 16);
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getUndoPath = exports.parseResourceWithoutFragment = exports.parseResource = exports.absolutify = exports.contextify = exports.makePathsAbsolute = exports.makePathsRelative = void 0;
10
- const path_1 = __importDefault(require("path"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
11
  const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/;
12
12
  const SEGMENTS_SPLIT_REGEXP = /([|!])/;
13
13
  const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
@@ -37,7 +37,7 @@ const absoluteToRequest = (context, maybeAbsolutePath) => {
37
37
  let resource = querySplitPos === -1
38
38
  ? maybeAbsolutePath
39
39
  : maybeAbsolutePath.slice(0, querySplitPos);
40
- resource = relativePathToRequest(path_1.default.posix.relative(context, resource));
40
+ resource = relativePathToRequest(node_path_1.default.posix.relative(context, resource));
41
41
  return querySplitPos === -1
42
42
  ? resource
43
43
  : resource + maybeAbsolutePath.slice(querySplitPos);
@@ -47,7 +47,7 @@ const absoluteToRequest = (context, maybeAbsolutePath) => {
47
47
  let resource = querySplitPos === -1
48
48
  ? maybeAbsolutePath
49
49
  : maybeAbsolutePath.slice(0, querySplitPos);
50
- resource = path_1.default.win32.relative(context, resource);
50
+ resource = node_path_1.default.win32.relative(context, resource);
51
51
  if (!WINDOWS_ABS_PATH_REGEXP.test(resource)) {
52
52
  resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/"));
53
53
  }
@@ -65,7 +65,7 @@ const absoluteToRequest = (context, maybeAbsolutePath) => {
65
65
  */
66
66
  const requestToAbsolute = (context, relativePath) => {
67
67
  if (relativePath.startsWith("./") || relativePath.startsWith("../"))
68
- return path_1.default.join(context, relativePath);
68
+ return node_path_1.default.join(context, relativePath);
69
69
  return relativePath;
70
70
  };
71
71
  const makeCacheable = (realFn) => {
@@ -130,11 +130,9 @@ const makeCacheableWithContext = (fn) => {
130
130
  if (cachedResult !== undefined) {
131
131
  return cachedResult;
132
132
  }
133
- else {
134
- const result = fn(context, identifier);
135
- innerSubCache.set(identifier, result);
136
- return result;
137
- }
133
+ const result = fn(context, identifier);
134
+ innerSubCache.set(identifier, result);
135
+ return result;
138
136
  };
139
137
  /**
140
138
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
@@ -170,11 +168,9 @@ const makeCacheableWithContext = (fn) => {
170
168
  if (cachedResult !== undefined) {
171
169
  return cachedResult;
172
170
  }
173
- else {
174
- const result = fn(context, identifier);
175
- innerSubCache.set(identifier, result);
176
- return result;
177
- }
171
+ const result = fn(context, identifier);
172
+ innerSubCache.set(identifier, result);
173
+ return result;
178
174
  };
179
175
  return boundFn;
180
176
  };
@@ -208,11 +204,9 @@ const makeCacheableWithContext = (fn) => {
208
204
  if (cachedResult !== undefined) {
209
205
  return cachedResult;
210
206
  }
211
- else {
212
- const result = fn(context, identifier);
213
- innerSubCache?.set(identifier, result);
214
- return result;
215
- }
207
+ const result = fn(context, identifier);
208
+ innerSubCache?.set(identifier, result);
209
+ return result;
216
210
  };
217
211
  return boundFn;
218
212
  };
@@ -13,7 +13,7 @@ const toBuffer = (bufLike) => {
13
13
  if (Buffer.isBuffer(bufLike)) {
14
14
  return bufLike;
15
15
  }
16
- else if (typeof bufLike === "string") {
16
+ if (typeof bufLike === "string") {
17
17
  return Buffer.from(bufLike);
18
18
  }
19
19
  throw new Error("Buffer or string expected");
@@ -10,15 +10,13 @@ const memoize = (fn) => {
10
10
  // @ts-expect-error
11
11
  return result;
12
12
  }
13
- else {
14
- result = fn();
15
- cache = true;
16
- // Allow to clean up memory for fn
17
- // and all dependent resources
18
- // @ts-expect-error
19
- fn = undefined;
20
- return result;
21
- }
13
+ result = fn();
14
+ cache = true;
15
+ // Allow to clean up memory for fn
16
+ // and all dependent resources
17
+ // @ts-expect-error
18
+ fn = undefined;
19
+ return result;
22
20
  };
23
21
  };
24
22
  exports.memoize = memoize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-beta.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -48,18 +48,19 @@
48
48
  "json-parse-even-better-errors": "^3.0.0",
49
49
  "neo-async": "2.6.2",
50
50
  "prebundle": "^1.1.0",
51
+ "typescript": "5.0.2",
51
52
  "tsc-alias": "^1.8.8",
52
53
  "watchpack": "^2.4.0",
53
54
  "webpack-sources": "3.2.3",
54
- "webpack-dev-server": "4.13.1",
55
- "zod": "^3.21.4",
55
+ "webpack-dev-server": "^5.0.4",
56
+ "zod": "^3.23.8",
56
57
  "zod-validation-error": "1.3.1"
57
58
  },
58
59
  "dependencies": {
59
60
  "@module-federation/runtime-tools": "0.2.3",
60
61
  "caniuse-lite": "^1.0.30001616",
61
- "@rspack/lite-tapable": "1.0.0-alpha.4",
62
- "@rspack/binding": "1.0.0-alpha.4"
62
+ "@rspack/binding": "1.0.0-beta.0",
63
+ "@rspack/lite-tapable": "1.0.0-beta.0"
63
64
  },
64
65
  "peerDependencies": {
65
66
  "@swc/helpers": ">=0.5.1"
@@ -70,9 +71,9 @@
70
71
  }
71
72
  },
72
73
  "scripts": {
73
- "build": "prebundle && tsc -b ./tsconfig.build.json && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
74
- "build:force": "prebundle && tsc -b ./tsconfig.build.json --force && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
75
- "dev": "prebundle && tsc -w",
74
+ "build": "tsc -b ./tsconfig.build.json && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
75
+ "build:force": "tsc -b ./tsconfig.build.json --force && tsc-alias -p tsconfig.build.json && npm run prepare-container-runtime",
76
+ "dev": "tsc -w",
76
77
  "prepare-container-runtime": "node ./scripts/prepare-container-runtime.js",
77
78
  "doc-coverage": "node scripts/check-documentation-coverage.mjs",
78
79
  "api-extractor": "api-extractor run --verbose",
@@ -1,2 +0,0 @@
1
- declare function _exports(urlString: string): string;
2
- export = _exports;