@rspack-debug/core 1.4.11 → 1.6.2

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 (145) hide show
  1. package/compiled/@swc/types/index.d.ts +15 -5
  2. package/compiled/@swc/types/package.json +1 -1
  3. package/compiled/browserslist-load-config/index.d.ts +11 -0
  4. package/compiled/browserslist-load-config/index.js +26 -40
  5. package/compiled/browserslist-load-config/package.json +1 -1
  6. package/compiled/watchpack/index.js +1015 -18
  7. package/compiled/webpack-sources/index.js +82 -82
  8. package/dist/Compilation.d.ts +17 -20
  9. package/dist/Compiler.d.ts +63 -32
  10. package/dist/Module.d.ts +3 -14
  11. package/dist/MultiCompiler.d.ts +7 -3
  12. package/dist/MultiStats.d.ts +3 -2
  13. package/dist/MultiWatching.d.ts +1 -1
  14. package/dist/NativeWatchFileSystem.d.ts +8 -2
  15. package/dist/NormalModuleFactory.d.ts +2 -2
  16. package/dist/Resolver.d.ts +13 -7
  17. package/dist/ResolverFactory.d.ts +8 -5
  18. package/dist/RspackError.d.ts +3 -0
  19. package/dist/RuntimeGlobals.d.ts +3 -0
  20. package/dist/RuntimeModule.d.ts +1 -1
  21. package/dist/VirtualModulesPlugin.d.ts +12 -0
  22. package/dist/Watching.d.ts +9 -0
  23. package/dist/builtin-loader/swc/pluginImport.d.ts +2 -2
  24. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/CircularDependencyRspackPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  33. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/DefinePlugin.d.ts +2 -2
  39. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -2
  40. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -2
  41. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/EsmLibraryPlugin.d.ts +11 -0
  49. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -1
  52. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -2
  57. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  60. package/dist/builtin-plugin/InlineExportsPlugin.d.ts +9 -0
  61. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  62. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
  65. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  66. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -2
  67. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  68. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  69. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -2
  70. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
  71. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  72. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  73. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +1 -2
  74. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +1 -2
  75. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
  76. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  77. package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
  78. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
  79. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  80. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  81. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  82. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
  83. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  84. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +3 -3
  85. package/dist/builtin-plugin/RslibPlugin.d.ts +1 -1
  86. package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
  87. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
  88. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  89. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  90. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
  91. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  92. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -2
  93. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +3 -2
  94. package/dist/builtin-plugin/URLPlugin.d.ts +9 -0
  95. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  96. package/dist/builtin-plugin/base.d.ts +2 -2
  97. package/dist/builtin-plugin/css-extract/index.d.ts +2 -2
  98. package/dist/builtin-plugin/html-plugin/options.d.ts +0 -1
  99. package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
  100. package/dist/builtin-plugin/index.d.ts +4 -0
  101. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -17
  102. package/dist/config/adapterRuleUse.d.ts +65 -7
  103. package/dist/config/defaults.d.ts +0 -9
  104. package/dist/config/devServer.d.ts +12 -13
  105. package/dist/config/index.d.ts +1 -0
  106. package/dist/config/normalization.d.ts +18 -3
  107. package/dist/config/types.d.ts +119 -18
  108. package/dist/container/ModuleFederationManifestPlugin.d.ts +37 -0
  109. package/dist/container/ModuleFederationPlugin.d.ts +3 -1
  110. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
  111. package/dist/cssExtractHmr.js +12 -13
  112. package/dist/cssExtractLoader.js +9 -10
  113. package/dist/exports.d.ts +16 -9
  114. package/dist/index.js +1556 -5443
  115. package/dist/lib/Cache.d.ts +1 -1
  116. package/dist/loader-runner/ModuleError.d.ts +7 -1
  117. package/dist/loader-runner/loadLoader.d.ts +2 -1
  118. package/dist/loader-runner/service.d.ts +1 -1
  119. package/dist/loader-runner/utils.d.ts +2 -1
  120. package/dist/moduleFederationDefaultRuntime.js +1 -1
  121. package/dist/stats/DefaultStatsFactoryPlugin.d.ts +16 -0
  122. package/dist/stats/statsFactoryUtils.d.ts +17 -1
  123. package/dist/util/ArrayQueue.d.ts +2 -2
  124. package/dist/util/bindingVersionCheck.d.ts +1 -1
  125. package/dist/util/comparators.d.ts +1 -1
  126. package/dist/util/fs.d.ts +25 -2
  127. package/dist/util/index.d.ts +0 -3
  128. package/dist/util/source.d.ts +5 -6
  129. package/dist/util/validateConfig.d.ts +5 -0
  130. package/dist/worker.js +152 -118
  131. package/hot/lazy-compilation-node.js +1 -3
  132. package/hot/lazy-compilation-web.js +4 -3
  133. package/module.d.ts +11 -14
  134. package/package.json +20 -20
  135. package/compiled/graceful-fs/index.d.ts +0 -13
  136. package/compiled/graceful-fs/index.js +0 -1063
  137. package/compiled/graceful-fs/license +0 -15
  138. package/compiled/graceful-fs/package.json +0 -1
  139. package/dist/lib/NormalModuleReplacementPlugin.d.ts +0 -29
  140. package/dist/loader-runner/ModuleWarning.d.ts +0 -7
  141. package/dist/schema/config.d.ts +0 -996
  142. package/dist/schema/loaders.d.ts +0 -400
  143. package/dist/schema/plugins.d.ts +0 -167
  144. package/dist/schema/utils.d.ts +0 -4
  145. package/dist/schema/validate.d.ts +0 -10
package/dist/worker.js CHANGED
@@ -1,8 +1,33 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
+ "./src/swc.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4
+ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
5
+ minify: ()=>minify,
6
+ minifySync: ()=>minifySync,
7
+ transform: ()=>transform,
8
+ transformSync: ()=>transformSync
9
+ });
10
+ var _rspack_binding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rspack/binding"), _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_rspack_binding__WEBPACK_IMPORTED_MODULE_0__);
11
+ async function minify(source, options) {
12
+ let _options = JSON.stringify(options || {});
13
+ return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().minify(source, _options);
14
+ }
15
+ function minifySync(source, options) {
16
+ let _options = JSON.stringify(options || {});
17
+ return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().minifySync(source, _options);
18
+ }
19
+ async function transform(source, options) {
20
+ let _options = JSON.stringify(options || {});
21
+ return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().transform(source, _options);
22
+ }
23
+ function transformSync(source, options) {
24
+ let _options = JSON.stringify(options || {});
25
+ return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().transformSync(source, _options);
26
+ }
27
+ },
3
28
  "./src/util/cleverMerge.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4
29
  __webpack_require__.d(__webpack_exports__, {
5
- R_: ()=>cleverMerge
30
+ ks: ()=>cleverMerge
6
31
  });
7
32
  let DYNAMIC_INFO = Symbol("cleverMerge dynamic info"), mergeCache = new WeakMap(), DELETE = Symbol("DELETE"), cachedCleverMerge = (first, second)=>{
8
33
  if (void 0 === second) return first;
@@ -181,11 +206,10 @@ var __webpack_modules__ = {
181
206
  "./src/util/createHash.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
182
207
  let createMd4, createXxhash64;
183
208
  __webpack_require__.d(__webpack_exports__, {
184
- j: ()=>createHash
209
+ n: ()=>createHash_createHash
185
210
  });
186
- let external_node_crypto_namespaceObject = require("node:crypto");
187
- var external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject), external_node_util_ = __webpack_require__("node:util");
188
- class WebpackError_WebpackError extends Error {
211
+ var external_node_util_ = __webpack_require__("node:util");
212
+ class WebpackError extends Error {
189
213
  loc;
190
214
  file;
191
215
  chunk;
@@ -193,34 +217,34 @@ var __webpack_modules__ = {
193
217
  details;
194
218
  hideStack;
195
219
  }
196
- Object.defineProperty(WebpackError_WebpackError.prototype, external_node_util_.inspect.custom, {
220
+ Object.defineProperty(WebpackError.prototype, external_node_util_.inspect.custom, {
197
221
  value: function() {
198
222
  return this.stack + (this.details ? `\n${this.details}` : "");
199
223
  },
200
224
  enumerable: !1,
201
225
  configurable: !0
202
226
  });
203
- let WebpackError = WebpackError_WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
227
+ let lib_WebpackError = WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
204
228
  function createMessage(method) {
205
229
  return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
206
230
  }
207
231
  class Message extends Error {
208
232
  constructor(){
209
233
  super(), this.stack = void 0, Error.captureStackTrace(this);
210
- let match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
234
+ const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
211
235
  this.message = match?.[1] ? createMessage(match[1]) : createMessage();
212
236
  }
213
237
  }
214
- class AbstractMethodError extends WebpackError {
238
+ class AbstractMethodError extends lib_WebpackError {
215
239
  constructor(){
216
240
  super(new Message().message), this.name = "AbstractMethodError";
217
241
  }
218
242
  }
219
243
  class Hash {
220
- update(data, inputEncoding) {
244
+ update() {
221
245
  throw new AbstractMethodError();
222
246
  }
223
- digest(encoding) {
247
+ digest() {
224
248
  throw new AbstractMethodError();
225
249
  }
226
250
  }
@@ -233,7 +257,7 @@ var __webpack_modules__ = {
233
257
  chunkSize;
234
258
  digestSize;
235
259
  constructor(instance, instancesPool, chunkSize, digestSize){
236
- let exports1 = instance.exports;
260
+ const exports1 = instance.exports;
237
261
  exports1.init(), this.exports = exports1, this.mem = Buffer.from(exports1.memory.buffer, 0, 65536), this.buffered = 0, this.instancesPool = instancesPool, this.chunkSize = chunkSize, this.digestSize = digestSize;
238
262
  }
239
263
  reset() {
@@ -337,7 +361,7 @@ var __webpack_modules__ = {
337
361
  constructor(){
338
362
  super(), this.string = "";
339
363
  }
340
- update(data, inputEncoding) {
364
+ update(data) {
341
365
  let normalizedData;
342
366
  return (normalizedData = Buffer.isBuffer(data) ? data.toString("utf-8") : data).startsWith("debug-digest-") && (normalizedData = Buffer.from(normalizedData.slice(13), "hex").toString()), this.string += `[${normalizedData}](${Error().stack?.split("\n", 3)[2]})\n`, this;
343
367
  }
@@ -358,7 +382,7 @@ var __webpack_modules__ = {
358
382
  return encoding ? this.wasmHash.digest(encoding) : this.wasmHash.digest();
359
383
  }
360
384
  }
361
- let createHash = (algorithm)=>{
385
+ let createHash_createHash = (algorithm)=>{
362
386
  if ("function" == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
363
387
  switch(algorithm){
364
388
  case "debug":
@@ -380,12 +404,24 @@ var __webpack_modules__ = {
380
404
  return createMd4();
381
405
  })());
382
406
  case "native-md4":
383
- return new BulkUpdateDecorator(()=>external_node_crypto_default().createHash("md4"), "md4");
407
+ return new BulkUpdateDecorator(()=>{
408
+ let { createHash } = __webpack_require__("node:crypto");
409
+ return createHash("md4");
410
+ }, "md4");
384
411
  default:
385
- return new BulkUpdateDecorator(()=>external_node_crypto_default().createHash(algorithm), algorithm);
412
+ return new BulkUpdateDecorator(()=>{
413
+ let { createHash } = __webpack_require__("node:crypto");
414
+ return createHash(algorithm);
415
+ }, algorithm);
386
416
  }
387
417
  };
388
418
  },
419
+ "@rspack/binding": function(module) {
420
+ module.exports = require("@rspack/binding");
421
+ },
422
+ "node:crypto": function(module) {
423
+ module.exports = require("node:crypto");
424
+ },
389
425
  "node:fs": function(module) {
390
426
  module.exports = require("node:fs");
391
427
  },
@@ -397,11 +433,6 @@ var __webpack_modules__ = {
397
433
  },
398
434
  "node:util": function(module) {
399
435
  module.exports = require("node:util");
400
- },
401
- tinypool: function(module) {
402
- module.exports = import("../compiled/tinypool/dist/index.js").then(function(module) {
403
- return module;
404
- });
405
436
  }
406
437
  }, __webpack_module_cache__ = {};
407
438
  function __webpack_require__(moduleId) {
@@ -436,9 +467,9 @@ for(var __webpack_i__ in (()=>{
436
467
  default: ()=>loader_runner_worker
437
468
  });
438
469
  let external_node_querystring_namespaceObject = require("node:querystring");
439
- var RequestType, RequestSyncType, external_node_querystring_default = __webpack_require__.n(external_node_querystring_namespaceObject), external_node_util_ = __webpack_require__("node:util");
440
- let external_node_worker_threads_namespaceObject = require("node:worker_threads"), binding_namespaceObject = require("@rspack/binding");
441
- var createHash = __webpack_require__("./src/util/createHash.ts");
470
+ var external_node_querystring_default = __webpack_require__.n(external_node_querystring_namespaceObject), external_node_util_ = __webpack_require__("node:util");
471
+ let external_node_worker_threads_namespaceObject = require("node:worker_threads");
472
+ var binding_ = __webpack_require__("@rspack/binding"), createHash = __webpack_require__("./src/util/createHash.ts");
442
473
  let external_node_path_namespaceObject = require("node:path");
443
474
  var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
444
475
  let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
@@ -536,7 +567,7 @@ for(var __webpack_i__ in (()=>{
536
567
  super(message), this.name = "LoaderRunnerError", Error.captureStackTrace(this, this.constructor);
537
568
  }
538
569
  };
539
- function loadLoader(loader, callback) {
570
+ function loadLoader(loader, compiler, callback) {
540
571
  if ("module" === loader.type) try {
541
572
  void 0 === url && (url = __webpack_require__("node:url")), import(url.pathToFileURL(loader.path).toString()).then((module)=>{
542
573
  handleResult(loader, module, callback);
@@ -550,7 +581,7 @@ for(var __webpack_i__ in (()=>{
550
581
  try {
551
582
  module = require(loader.path);
552
583
  } catch (e) {
553
- if (e instanceof Error && "EMFILE" === e.code) return void setImmediate(loadLoader.bind(null, loader, callback));
584
+ if (e instanceof Error && "EMFILE" === e.code) return void setImmediate(loadLoader.bind(null, loader, compiler, callback));
554
585
  return callback(e);
555
586
  }
556
587
  return handleResult(loader, module, callback);
@@ -562,7 +593,6 @@ for(var __webpack_i__ in (()=>{
562
593
  function isWorkerResponseMessage(message) {
563
594
  return "response" === message.type;
564
595
  }
565
- var service_RequestType = ((RequestType = {}).AddDependency = "AddDependency", RequestType.AddContextDependency = "AddContextDependency", RequestType.AddMissingDependency = "AddMissingDependency", RequestType.AddBuildDependency = "AddBuildDependency", RequestType.GetDependencies = "GetDependencies", RequestType.GetContextDependencies = "GetContextDependencies", RequestType.GetMissingDependencies = "GetMissingDependencies", RequestType.ClearDependencies = "ClearDependencies", RequestType.Resolve = "Resolve", RequestType.GetResolve = "GetResolve", RequestType.GetLogger = "GetLogger", RequestType.EmitError = "EmitError", RequestType.EmitWarning = "EmitWarning", RequestType.EmitFile = "EmitFile", RequestType.EmitDiagnostic = "EmitDiagnostic", RequestType.SetCacheable = "SetCacheable", RequestType.ImportModule = "ImportModule", RequestType.UpdateLoaderObjects = "UpdateLoaderObjects", RequestType.CompilationGetPath = "CompilationGetPath", RequestType.CompilationGetPathWithInfo = "CompilationGetPathWithInfo", RequestType.CompilationGetAssetPath = "CompilationGetAssetPath", RequestType.CompilationGetAssetPathWithInfo = "CompilationGetAssetPathWithInfo", RequestType), service_RequestSyncType = ((RequestSyncType = {}).WaitForPendingRequest = "WaitForPendingRequest", RequestSyncType);
566
596
  function serializeError(error) {
567
597
  if (error instanceof Error || error && "object" == typeof error && "message" in error) return {
568
598
  ...error,
@@ -627,21 +657,21 @@ for(var __webpack_i__ in (()=>{
627
657
  return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
628
658
  }(resourcePath) : null, pendingDependencyRequest = [];
629
659
  loaderContext.parallel = !0, loaderContext.dependency = loaderContext.addDependency = function(file) {
630
- pendingDependencyRequest.push(sendRequest(service_RequestType.AddDependency, file));
660
+ pendingDependencyRequest.push(sendRequest("AddDependency", file));
631
661
  }, loaderContext.addContextDependency = function(context) {
632
- pendingDependencyRequest.push(sendRequest(service_RequestType.AddContextDependency, context));
662
+ pendingDependencyRequest.push(sendRequest("AddContextDependency", context));
633
663
  }, loaderContext.addBuildDependency = function(file) {
634
- pendingDependencyRequest.push(sendRequest(service_RequestType.AddBuildDependency, file));
664
+ pendingDependencyRequest.push(sendRequest("AddBuildDependency", file));
635
665
  }, loaderContext.getDependencies = function() {
636
- return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetDependencies).wait();
666
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetDependencies").wait();
637
667
  }, loaderContext.getContextDependencies = function() {
638
- return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetContextDependencies).wait();
668
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetContextDependencies").wait();
639
669
  }, loaderContext.getMissingDependencies = function() {
640
- return waitForPendingRequest(pendingDependencyRequest), sendRequest(service_RequestType.GetMissingDependencies).wait();
670
+ return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetMissingDependencies").wait();
641
671
  }, loaderContext.clearDependencies = function() {
642
- pendingDependencyRequest.push(sendRequest(service_RequestType.ClearDependencies));
672
+ pendingDependencyRequest.push(sendRequest("ClearDependencies"));
643
673
  }, loaderContext.resolve = function(context, request, callback) {
644
- sendRequest(service_RequestType.Resolve, context, request).then((result)=>{
674
+ sendRequest("Resolve", context, request).then((result)=>{
645
675
  callback(null, result);
646
676
  }, (err)=>{
647
677
  callback(err);
@@ -649,13 +679,13 @@ for(var __webpack_i__ in (()=>{
649
679
  }, loaderContext.getResolve = function(options) {
650
680
  return (context, request, callback)=>{
651
681
  if (!callback) return new Promise((resolve, reject)=>{
652
- sendRequest(service_RequestType.GetResolve, options, context, request).then((result)=>{
682
+ sendRequest("GetResolve", options, context, request).then((result)=>{
653
683
  resolve(result);
654
684
  }, (err)=>{
655
685
  reject(err);
656
686
  });
657
687
  });
658
- sendRequest(service_RequestType.GetResolve, options, context, request).then((result)=>{
688
+ sendRequest("GetResolve", options, context, request).then((result)=>{
659
689
  callback(null, result);
660
690
  }, (err)=>{
661
691
  callback(err);
@@ -664,110 +694,115 @@ for(var __webpack_i__ in (()=>{
664
694
  }, loaderContext.getLogger = function(name) {
665
695
  return {
666
696
  error (...args) {
667
- sendRequest(service_RequestType.GetLogger, "error", name, args);
697
+ sendRequest("GetLogger", "error", name, args);
668
698
  },
669
699
  warn (...args) {
670
- sendRequest(service_RequestType.GetLogger, "warn", name, args);
700
+ sendRequest("GetLogger", "warn", name, args);
671
701
  },
672
702
  info (...args) {
673
- sendRequest(service_RequestType.GetLogger, "info", name, args);
703
+ sendRequest("GetLogger", "info", name, args);
674
704
  },
675
705
  log (...args) {
676
- sendRequest(service_RequestType.GetLogger, "log", name, args);
706
+ sendRequest("GetLogger", "log", name, args);
677
707
  },
678
708
  debug (...args) {
679
- sendRequest(service_RequestType.GetLogger, "debug", name, args);
709
+ sendRequest("GetLogger", "debug", name, args);
680
710
  },
681
711
  assert (assertion, ...args) {
682
- assertion || sendRequest(service_RequestType.GetLogger, "error", name, args);
712
+ assertion || sendRequest("GetLogger", "error", name, args);
683
713
  },
684
714
  trace () {
685
- sendRequest(service_RequestType.GetLogger, "trace", name, [
715
+ sendRequest("GetLogger", "trace", name, [
686
716
  "Trace"
687
717
  ]);
688
718
  },
689
719
  clear () {
690
- sendRequest(service_RequestType.GetLogger, "clear", name);
720
+ sendRequest("GetLogger", "clear", name);
691
721
  },
692
722
  status (...args) {
693
- sendRequest(service_RequestType.GetLogger, "status", name, args);
723
+ sendRequest("GetLogger", "status", name, args);
694
724
  },
695
725
  group (...args) {
696
- sendRequest(service_RequestType.GetLogger, "group", name, args);
726
+ sendRequest("GetLogger", "group", name, args);
697
727
  },
698
728
  groupCollapsed (...args) {
699
- sendRequest(service_RequestType.GetLogger, "groupCollapsed", name, args);
729
+ sendRequest("GetLogger", "groupCollapsed", name, args);
700
730
  },
701
731
  groupEnd (...args) {
702
- sendRequest(service_RequestType.GetLogger, "groupEnd", name, args);
732
+ sendRequest("GetLogger", "groupEnd", name, args);
703
733
  },
704
734
  profile (label) {
705
- sendRequest(service_RequestType.GetLogger, "profile", name, [
735
+ sendRequest("GetLogger", "profile", name, [
706
736
  label
707
737
  ]);
708
738
  },
709
739
  profileEnd (label) {
710
- sendRequest(service_RequestType.GetLogger, "profileEnd", name, [
740
+ sendRequest("GetLogger", "profileEnd", name, [
711
741
  label
712
742
  ]);
713
743
  },
714
744
  time (label) {
715
- sendRequest(service_RequestType.GetLogger, "time", name, [
745
+ sendRequest("GetLogger", "time", name, [
716
746
  label
717
747
  ]);
718
748
  },
719
749
  timeEnd (label) {
720
- sendRequest(service_RequestType.GetLogger, "timeEnd", name, [
750
+ sendRequest("GetLogger", "timeEnd", name, [
721
751
  label
722
752
  ]);
723
753
  },
724
754
  timeLog (label, ...args) {
725
- sendRequest(service_RequestType.GetLogger, "timeLog", name, [
755
+ sendRequest("GetLogger", "timeLog", name, [
726
756
  label,
727
757
  ...args
728
758
  ]);
729
759
  },
730
760
  timeAggregate (label) {
731
- sendRequest(service_RequestType.GetLogger, "timeAggregate", name, [
761
+ sendRequest("GetLogger", "timeAggregate", name, [
732
762
  label
733
763
  ]);
734
764
  },
735
765
  timeAggregateEnd (label) {
736
- sendRequest(service_RequestType.GetLogger, "timeAggregateEnd", name, [
766
+ sendRequest("GetLogger", "timeAggregateEnd", name, [
737
767
  label
738
768
  ]);
739
769
  }
740
770
  };
741
771
  }, loaderContext.emitError = function(err) {
742
- sendRequest(service_RequestType.EmitError, serializeError(err));
772
+ sendRequest("EmitError", serializeError(err));
743
773
  }, loaderContext.emitWarning = function(warning) {
744
- sendRequest(service_RequestType.EmitWarning, serializeError(warning));
774
+ sendRequest("EmitWarning", serializeError(warning));
745
775
  }, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
746
- sendRequest(service_RequestType.EmitFile, name, content, sourceMap, assetInfo);
776
+ sendRequest("EmitFile", name, content, sourceMap, assetInfo);
747
777
  }, loaderContext.experiments = {
748
778
  emitDiagnostic (diagnostic) {
749
- sendRequest(service_RequestType.EmitDiagnostic, diagnostic);
779
+ sendRequest("EmitDiagnostic", diagnostic);
750
780
  }
751
781
  };
752
782
  let getAbsolutify = memoize(()=>absolutify.bindCache({})), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, {})), getContextify = memoize(()=>contextify.bindCache({})), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, {}));
753
783
  loaderContext.utils = {
754
784
  absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
755
785
  contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
756
- createHash: (type)=>(0, createHash.j)(type || loaderContext._compilation.outputOptions.hashFunction)
786
+ createHash: (type)=>(0, createHash.n)(type || loaderContext._compilation.outputOptions.hashFunction)
757
787
  }, loaderContext._compiler = {
758
788
  ...loaderContext._compiler,
789
+ rspack: {
790
+ experiments: {
791
+ swc: __webpack_require__("./src/swc.ts")
792
+ }
793
+ },
759
794
  webpack: {
760
795
  util: {
761
- createHash: __webpack_require__("./src/util/createHash.ts").j,
762
- cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").R_
796
+ createHash: __webpack_require__("./src/util/createHash.ts").n,
797
+ cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").ks
763
798
  }
764
799
  }
765
800
  }, loaderContext._compilation = {
766
801
  ...loaderContext._compilation,
767
- getPath: (filename, data)=>sendRequest(service_RequestType.CompilationGetPath, filename, data).wait(),
768
- getPathWithInfo: (filename, data)=>sendRequest(service_RequestType.CompilationGetPathWithInfo, filename, data).wait(),
769
- getAssetPath: (filename, data)=>sendRequest(service_RequestType.CompilationGetAssetPath, filename, data).wait(),
770
- getAssetPathWithInfo: (filename, data)=>sendRequest(service_RequestType.CompilationGetAssetPathWithInfo, filename, data).wait()
802
+ getPath: (filename, data)=>sendRequest("CompilationGetPath", filename, data).wait(),
803
+ getPathWithInfo: (filename, data)=>sendRequest("CompilationGetPathWithInfo", filename, data).wait(),
804
+ getAssetPath: (filename, data)=>sendRequest("CompilationGetAssetPath", filename, data).wait(),
805
+ getAssetPathWithInfo: (filename, data)=>sendRequest("CompilationGetAssetPathWithInfo", filename, data).wait()
771
806
  };
772
807
  let _module = loaderContext._module;
773
808
  loaderContext._module = {
@@ -779,13 +814,13 @@ for(var __webpack_i__ in (()=>{
779
814
  rawRequest: _module.rawRequest
780
815
  }, loaderContext.importModule = function(request, options, callback) {
781
816
  if (!callback) return new Promise((resolve, reject)=>{
782
- sendRequest(service_RequestType.ImportModule, request, options).then((result)=>{
817
+ sendRequest("ImportModule", request, options).then((result)=>{
783
818
  resolve(result);
784
819
  }, (err)=>{
785
820
  reject(err);
786
821
  });
787
822
  });
788
- sendRequest(service_RequestType.ImportModule, request, options).then((result)=>{
823
+ sendRequest("ImportModule", request, options).then((result)=>{
789
824
  callback(null, result);
790
825
  }, (err)=>{
791
826
  callback(err);
@@ -820,7 +855,7 @@ for(var __webpack_i__ in (()=>{
820
855
  else options = external_node_querystring_default().parse(options);
821
856
  return null == options && (options = {}), options;
822
857
  }, loaderContext.cacheable = function(flag) {
823
- !1 === flag && sendRequest(service_RequestType.SetCacheable, !1);
858
+ !1 === flag && sendRequest("SetCacheable", !1);
824
859
  }, Object.defineProperty(loaderContext, "data", {
825
860
  enumerable: !0,
826
861
  get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
@@ -830,7 +865,7 @@ for(var __webpack_i__ in (()=>{
830
865
  });
831
866
  let shouldYieldToMainThread = (currentLoaderObject)=>!!(!currentLoaderObject?.parallel || currentLoaderObject?.request.startsWith("builtin:"));
832
867
  switch(loaderState){
833
- case binding_namespaceObject.JsLoaderState.Pitching:
868
+ case binding_.JsLoaderState.Pitching:
834
869
  for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
835
870
  let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
836
871
  if (shouldYieldToMainThread(currentLoaderObject)) break;
@@ -838,7 +873,7 @@ for(var __webpack_i__ in (()=>{
838
873
  loaderContext.loaderIndex += 1;
839
874
  continue;
840
875
  }
841
- await loadLoaderAsync(currentLoaderObject);
876
+ await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
842
877
  let fn = currentLoaderObject.pitch;
843
878
  if ((currentLoaderObject.pitchExecuted = !0, fn) && (args = await utils_runSyncOrAsync(fn, loaderContext, [
844
879
  loaderContext.remainingRequest,
@@ -846,24 +881,28 @@ for(var __webpack_i__ in (()=>{
846
881
  currentLoaderObject.loaderItem.data
847
882
  ]) || []).some((value)=>void 0 !== value)) break;
848
883
  }
849
- case binding_namespaceObject.JsLoaderState.Normal:
884
+ break;
885
+ case binding_.JsLoaderState.Normal:
850
886
  for(; loaderContext.loaderIndex >= 0;){
851
- var args1, raw;
852
887
  let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
853
888
  if (shouldYieldToMainThread(currentLoaderObject)) break;
854
889
  if (currentLoaderObject.normalExecuted) {
855
890
  loaderContext.loaderIndex--;
856
891
  continue;
857
892
  }
858
- await loadLoaderAsync(currentLoaderObject);
893
+ await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
859
894
  let fn = currentLoaderObject.normal;
860
- currentLoaderObject.normalExecuted = !0, fn && (args1 = args, !(raw = !!currentLoaderObject.raw) && args1[0] instanceof Uint8Array ? args1[0] = function(buf) {
861
- let str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf);
862
- return 0xfeff === str.charCodeAt(0) ? str.slice(1) : str;
863
- }(args1[0]) : raw && "string" == typeof args1[0] && (args1[0] = Buffer.from(args1[0], "utf-8")), raw && args1[0] instanceof Uint8Array && !Buffer.isBuffer(args1[0]) && (args1[0] = Buffer.from(args1[0].buffer)), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
895
+ currentLoaderObject.normalExecuted = !0, fn && (!function(args, raw) {
896
+ if (!raw && args[0] instanceof Uint8Array) {
897
+ var buf;
898
+ let isShared, str;
899
+ args[0] = (isShared = (buf = args[0]).buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === "SharedArrayBuffer", 0xfeff === (str = decoder.decode(isShared ? Buffer.from(buf) : buf)).charCodeAt(0) ? str.slice(1) : str);
900
+ } else raw && "string" == typeof args[0] && (args[0] = Buffer.from(args[0], "utf-8"));
901
+ raw && args[0] instanceof Uint8Array && !Buffer.isBuffer(args[0]) && (args[0] = Buffer.from(args[0].buffer));
902
+ }(args, !!currentLoaderObject.raw), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
864
903
  }
865
904
  }
866
- return sendRequest(service_RequestType.UpdateLoaderObjects, loaderContext.loaders.map((item)=>({
905
+ return sendRequest("UpdateLoaderObjects", loaderContext.loaders.map((item)=>({
867
906
  data: item.loaderItem.data,
868
907
  normalExecuted: item.normalExecuted,
869
908
  pitchExecuted: item.pitchExecuted
@@ -882,47 +921,42 @@ for(var __webpack_i__ in (()=>{
882
921
  }
883
922
  }
884
923
  let loader_runner_worker = function(workerOptions) {
885
- var sendRequest;
886
- let workerData = workerOptions.workerData;
924
+ var workerPort, workerSyncPort, sendRequest, workerSyncPort1;
925
+ let sendRequest1, workerData = workerOptions.workerData;
887
926
  delete workerOptions.workerData, workerData.workerPort.on("message", handleIncomingResponses);
888
- let sendRequest1 = function(workerPort, workerSyncPort) {
889
- var workerSyncPort1;
890
- let sendRequest = (requestType, ...args)=>{
891
- let id = nextId++;
892
- workerPort.postMessage({
893
- type: "request",
894
- id,
895
- requestType,
896
- data: args
897
- });
898
- let result = new Promise((resolve, reject)=>{
899
- responseCallbacks[id] = (err, data)=>{
900
- if (err) return void reject(err);
901
- resolve(data);
902
- };
903
- });
904
- return result.wait = ()=>sendRequest.sync(service_RequestSyncType.WaitForPendingRequest, id), result.id = id, result;
905
- };
906
- return sendRequest.sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
907
- let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
908
- workerSyncPort1.postMessage({
909
- type: "request-sync",
910
- id,
911
- requestType,
912
- data: args,
913
- sharedBuffer
914
- });
915
- let status = Atomics.wait(sharedBufferView, 0, 0);
916
- if ("ok" !== status && "not-equal" !== status) throw Error(`Internal error: Atomics.wait() failed: ${status}`);
917
- let { message } = (0, external_node_worker_threads_namespaceObject.receiveMessageOnPort)(workerSyncPort1);
918
- if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
919
- if (isWorkerResponseMessage(message)) return message.data;
920
- throw message.error;
921
- }), sendRequest;
922
- }(workerData.workerPort, workerData.workerSyncPort), waitFor = (sendRequest = sendRequest1, (requests)=>sendRequest.sync(service_RequestSyncType.WaitForPendingRequest, (Array.isArray(requests) ? requests : [
927
+ let sendRequest2 = (workerPort = workerData.workerPort, workerSyncPort = workerData.workerSyncPort, (sendRequest1 = (requestType, ...args)=>{
928
+ let id = nextId++;
929
+ workerPort.postMessage({
930
+ type: "request",
931
+ id,
932
+ requestType,
933
+ data: args
934
+ });
935
+ let result = new Promise((resolve, reject)=>{
936
+ responseCallbacks[id] = (err, data)=>{
937
+ err ? reject(err) : resolve(data);
938
+ };
939
+ });
940
+ return result.wait = ()=>sendRequest1.sync("WaitForPendingRequest", id), result.id = id, result;
941
+ }).sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
942
+ let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
943
+ workerSyncPort1.postMessage({
944
+ type: "request-sync",
945
+ id,
946
+ requestType,
947
+ data: args,
948
+ sharedBuffer
949
+ });
950
+ let status = Atomics.wait(sharedBufferView, 0, 0);
951
+ if ("ok" !== status && "not-equal" !== status) throw Error(`Internal error: Atomics.wait() failed: ${status}`);
952
+ let { message } = (0, external_node_worker_threads_namespaceObject.receiveMessageOnPort)(workerSyncPort1);
953
+ if (id !== message.id) throw Error(`Unexpected response id: ${message.id}, expected: ${id}`);
954
+ if (isWorkerResponseMessage(message)) return message.data;
955
+ throw message.error;
956
+ }), sendRequest1), waitFor = (sendRequest = sendRequest2, (requests)=>sendRequest.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
923
957
  requests
924
958
  ]).map((request)=>request.id)));
925
- loaderImpl(workerOptions, sendRequest1, waitFor).then(async (data)=>{
959
+ loaderImpl(workerOptions, sendRequest2, waitFor).then(async (data)=>{
926
960
  workerData.workerPort.postMessage({
927
961
  type: "done",
928
962
  data
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  var urlBase = decodeURIComponent(__resourceQuery.slice(1));
4
2
 
5
3
  /**
@@ -16,7 +14,7 @@ exports.activate = function (options) {
16
14
  var request = (
17
15
  urlBase.startsWith("https") ? require("https") : require("http")
18
16
  ).request(
19
- urlBase + data,
17
+ urlBase + encodeURIComponent(data),
20
18
  {
21
19
  agent: false,
22
20
  headers: { accept: "text/event-stream" }
@@ -1,5 +1,3 @@
1
-
2
-
3
1
  if (typeof EventSource !== "function") {
4
2
  throw new Error(
5
3
  "Environment doesn't support lazy compilation (requires EventSource)"
@@ -16,7 +14,10 @@ var updateEventSource = function updateEventSource() {
16
14
  if (activeEventSource) activeEventSource.close();
17
15
  if (compiling.size) {
18
16
  activeEventSource = new EventSource(
19
- urlBase + Array.from(compiling).join("@")
17
+ urlBase +
18
+ Array.from(compiling, function (module) {
19
+ return encodeURIComponent(module);
20
+ }).join("@")
20
21
  );
21
22
  /**
22
23
  * @this {EventSource}
package/module.d.ts CHANGED
@@ -111,16 +111,15 @@ declare namespace Rspack {
111
111
  onErrored?: (event: ErroredEvent) => void;
112
112
  }
113
113
 
114
- enum HotUpdateStatus {
115
- idle = "idle",
116
- check = "check",
117
- prepare = "prepare",
118
- ready = "ready",
119
- dispose = "dispose",
120
- apply = "apply",
121
- abort = "abort",
122
- fail = "fail"
123
- }
114
+ type HotUpdateStatus =
115
+ | "idle"
116
+ | "check"
117
+ | "prepare"
118
+ | "ready"
119
+ | "dispose"
120
+ | "apply"
121
+ | "abort"
122
+ | "fail";
124
123
 
125
124
  interface Hot {
126
125
  accept: {
@@ -178,7 +177,7 @@ declare namespace Rspack {
178
177
  loaded: boolean;
179
178
  parents: NodeJS.Module["id"][] | null | undefined;
180
179
  children: NodeJS.Module["id"][];
181
- hot?: Hot | undefined;
180
+ hot?: Hot;
182
181
  }
183
182
 
184
183
  interface RequireResolve {
@@ -218,9 +217,7 @@ declare namespace Rspack {
218
217
 
219
218
  interface ImportMeta {
220
219
  url: string;
221
- // TODO: unsupported
222
- // webpack: number;
223
- webpackHot: Rspack.Hot;
220
+ webpackHot?: Rspack.Hot;
224
221
  webpackContext: (
225
222
  request: string,
226
223
  options?: {