@rspack-canary/browser 1.6.0-canary-e3199f44-20251020173943 → 1.6.0-canary-6cd722f4-20251022123039

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.
@@ -1,3 +1,12 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/Watching.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
9
+ */
1
10
  import type { Callback } from "@rspack/lite-tapable";
2
11
  import type { Compiler } from ".";
3
12
  import { Stats } from ".";
@@ -1,5 +1,11 @@
1
1
  import type { Compiler } from "../Compiler";
2
2
  export declare class EsmLibraryPlugin {
3
3
  static PLUGIN_NAME: string;
4
+ options?: {
5
+ preserveModules?: string;
6
+ };
7
+ constructor(options?: {
8
+ preserveModules?: string;
9
+ });
4
10
  apply(compiler: Compiler): void;
5
11
  }
@@ -1,12 +1,3 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/defaults.js
4
- *
5
- * MIT Licensed
6
- * Author Tobias Koppers @sokra
7
- * Copyright (c) JS Foundation and other contributors
8
- * https://github.com/webpack/webpack/blob/main/LICENSE
9
- */
10
1
  import type { RspackOptionsNormalized } from "./normalization";
11
2
  export declare const applyRspackOptionsDefaults: (options: RspackOptionsNormalized) => void;
12
3
  export declare const applyRspackOptionsBaseDefaults: (options: RspackOptionsNormalized) => void;
package/dist/index.mjs CHANGED
@@ -34932,7 +34932,7 @@ __webpack_require__.d(exports_namespaceObject, {
34932
34932
  DllReferencePlugin: ()=>DllReferencePlugin,
34933
34933
  DynamicEntryPlugin: ()=>DynamicEntryPlugin,
34934
34934
  EntryDependency: ()=>external_rspack_wasi_browser_js_.EntryDependency,
34935
- EntryOptionPlugin: ()=>lib_EntryOptionPlugin,
34935
+ EntryOptionPlugin: ()=>EntryOptionPlugin,
34936
34936
  EntryPlugin: ()=>EntryPlugin,
34937
34937
  EnvironmentPlugin: ()=>EnvironmentPlugin,
34938
34938
  EvalDevToolModulePlugin: ()=>EvalDevToolModulePlugin,
@@ -37544,12 +37544,10 @@ const DllEntryPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPlugi
37544
37544
  name: options.name
37545
37545
  }));
37546
37546
  const DllReferenceAgencyPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.DllReferenceAgencyPlugin, (options)=>options);
37547
- var assert = __webpack_require__("../../node_modules/.pnpm/assert@2.1.0/node_modules/assert/build/assert.js");
37548
- var assert_default = /*#__PURE__*/ __webpack_require__.n(assert);
37549
- class EntryOptionPlugin {
37547
+ class EntryOptionPlugin_EntryOptionPlugin {
37550
37548
  apply(compiler) {
37551
37549
  compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry)=>{
37552
- EntryOptionPlugin.applyEntryOption(compiler, context, entry);
37550
+ EntryOptionPlugin_EntryOptionPlugin.applyEntryOption(compiler, context, entry);
37553
37551
  return true;
37554
37552
  });
37555
37553
  }
@@ -37557,8 +37555,8 @@ class EntryOptionPlugin {
37557
37555
  if ("function" == typeof entry) new DynamicEntryPlugin(context, entry).apply(compiler);
37558
37556
  else for (const name of Object.keys(entry)){
37559
37557
  const desc = entry[name];
37560
- const options = EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
37561
- assert_default()(void 0 !== desc.import, "desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called");
37558
+ const options = EntryOptionPlugin_EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
37559
+ if (void 0 === desc.import) throw new Error("desc.import should not be `undefined` once `EntryOptionPlugin.applyEntryOption` is called");
37562
37560
  for (const entry of desc.import)new EntryPlugin(context, entry, options).apply(compiler);
37563
37561
  }
37564
37562
  }
@@ -37578,7 +37576,7 @@ class EntryOptionPlugin {
37578
37576
  return options;
37579
37577
  }
37580
37578
  }
37581
- const lib_EntryOptionPlugin = EntryOptionPlugin;
37579
+ const EntryOptionPlugin = EntryOptionPlugin_EntryOptionPlugin;
37582
37580
  const OriginEntryPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.EntryPlugin, (context, entry, options = "")=>{
37583
37581
  const entryOptions = "string" == typeof options ? {
37584
37582
  name: options
@@ -37624,7 +37622,7 @@ class DynamicEntryPlugin extends RspackBuiltinPlugin {
37624
37622
  entry: async ()=>{
37625
37623
  const result = await this.entry();
37626
37624
  return Object.entries(result).map(([name, desc])=>{
37627
- const options = lib_EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
37625
+ const options = EntryOptionPlugin.entryDescriptionToOptions(compiler, name, desc);
37628
37626
  return {
37629
37627
  import: desc.import,
37630
37628
  options: getRawEntryOptions(options)
@@ -37732,6 +37730,7 @@ function EsmLibraryPlugin_define_property(obj, key, value) {
37732
37730
  }
37733
37731
  class EsmLibraryPlugin {
37734
37732
  apply(compiler) {
37733
+ var _this_options;
37735
37734
  new RemoveDuplicateModulesPlugin().apply(compiler);
37736
37735
  const { splitChunks } = compiler.options.optimization;
37737
37736
  if (splitChunks) {
@@ -37742,9 +37741,15 @@ class EsmLibraryPlugin {
37742
37741
  if (err = checkConfig(compiler.options)) throw new src_0.WebpackError(`Conflicted config for ${EsmLibraryPlugin.PLUGIN_NAME}: ${err}`);
37743
37742
  compiler.__internal__registerBuiltinPlugin({
37744
37743
  name: external_rspack_wasi_browser_js_.BuiltinPluginName.EsmLibraryPlugin,
37745
- options: {}
37744
+ options: {
37745
+ preserveModules: null == (_this_options = this.options) ? void 0 : _this_options.preserveModules
37746
+ }
37746
37747
  });
37747
37748
  }
37749
+ constructor(options){
37750
+ EsmLibraryPlugin_define_property(this, "options", void 0);
37751
+ this.options = options;
37752
+ }
37748
37753
  }
37749
37754
  EsmLibraryPlugin_define_property(EsmLibraryPlugin, "PLUGIN_NAME", "EsmLibraryPlugin");
37750
37755
  function checkConfig(config) {
@@ -38358,7 +38363,6 @@ trace_define_property(trace_JavaScriptTracer, "layer", void 0);
38358
38363
  trace_define_property(trace_JavaScriptTracer, "output", void 0);
38359
38364
  trace_define_property(trace_JavaScriptTracer, "session", void 0);
38360
38365
  trace_define_property(trace_JavaScriptTracer, "counter", 10000);
38361
- var crypto_browserify = __webpack_require__("../../node_modules/.pnpm/crypto-browserify@3.12.1/node_modules/crypto-browserify/index.js");
38362
38366
  const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
38363
38367
  function createMessage(method) {
38364
38368
  return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
@@ -38627,7 +38631,7 @@ class WasmHashAdapter extends Hash {
38627
38631
  this.wasmHash = wasmHash;
38628
38632
  }
38629
38633
  }
38630
- const createHash = (algorithm)=>{
38634
+ const createHash_createHash = (algorithm)=>{
38631
38635
  if ("function" == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
38632
38636
  switch(algorithm){
38633
38637
  case "debug":
@@ -38643,9 +38647,15 @@ const createHash = (algorithm)=>{
38643
38647
  return new WasmHashAdapter(hash);
38644
38648
  }
38645
38649
  case "native-md4":
38646
- return new BulkUpdateDecorator(()=>crypto_browserify.createHash("md4"), "md4");
38650
+ return new BulkUpdateDecorator(()=>{
38651
+ const { createHash } = __webpack_require__("../../node_modules/.pnpm/crypto-browserify@3.12.1/node_modules/crypto-browserify/index.js");
38652
+ return createHash("md4");
38653
+ }, "md4");
38647
38654
  default:
38648
- return new BulkUpdateDecorator(()=>crypto_browserify.createHash(algorithm), algorithm);
38655
+ return new BulkUpdateDecorator(()=>{
38656
+ const { createHash } = __webpack_require__("../../node_modules/.pnpm/crypto-browserify@3.12.1/node_modules/crypto-browserify/index.js");
38657
+ return createHash(algorithm);
38658
+ }, algorithm);
38649
38659
  }
38650
38660
  };
38651
38661
  const memoize = (fn)=>{
@@ -38677,40 +38687,27 @@ function ModuleError_define_property(obj, key, value) {
38677
38687
  else obj[key] = value;
38678
38688
  return obj;
38679
38689
  }
38690
+ const ModuleError_createMessage = (err, type, from)=>{
38691
+ let message = `Module ${type}${from ? ` (from ${from}):\n` : ": "}`;
38692
+ if (err && "object" == typeof err && err.message) message += err.message;
38693
+ else if (err) message += err;
38694
+ return message;
38695
+ };
38696
+ const getErrorDetails = (err)=>err && "object" == typeof err && err.stack ? cleanUp(err.stack, err.name, err.message) : void 0;
38680
38697
  class ModuleError extends lib_WebpackError {
38681
38698
  constructor(err, { from } = {}){
38682
- let message = "Module Error";
38683
- if (from) message += ` (from ${from}):\n`;
38684
- else message += ": ";
38685
- if (err && "object" == typeof err && err.message) message += err.message;
38686
- else if (err) message += err;
38687
- super(message), ModuleError_define_property(this, "error", void 0);
38699
+ super(ModuleError_createMessage(err, "Error", from)), ModuleError_define_property(this, "error", void 0);
38688
38700
  this.name = "ModuleError";
38689
38701
  this.error = err;
38690
- this.details = err && "object" == typeof err && err.stack ? cleanUp(err.stack, err.name, err.message) : void 0;
38702
+ this.details = getErrorDetails(err);
38691
38703
  }
38692
38704
  }
38693
- function ModuleWarning_define_property(obj, key, value) {
38694
- if (key in obj) Object.defineProperty(obj, key, {
38695
- value: value,
38696
- enumerable: true,
38697
- configurable: true,
38698
- writable: true
38699
- });
38700
- else obj[key] = value;
38701
- return obj;
38702
- }
38703
38705
  class ModuleWarning extends lib_WebpackError {
38704
38706
  constructor(err, { from } = {}){
38705
- let message = "Module Warning";
38706
- if (from) message += ` (from ${from}):\n`;
38707
- else message += ": ";
38708
- if (err && "object" == typeof err && err.message) message += err.message;
38709
- else if (err) message += err;
38710
- super(message), ModuleWarning_define_property(this, "error", void 0);
38707
+ super(ModuleError_createMessage(err, "Warning", from)), ModuleError_define_property(this, "error", void 0);
38711
38708
  this.name = "ModuleWarning";
38712
38709
  this.error = err;
38713
- this.details = err && "object" == typeof err && err.stack ? cleanUp(err.stack, err.name, err.message) : void 0;
38710
+ this.details = getErrorDetails(err);
38714
38711
  }
38715
38712
  }
38716
38713
  async function service_run() {
@@ -38888,18 +38885,18 @@ class LoaderObject {
38888
38885
  return this.loaderItem.pitchExecuted;
38889
38886
  }
38890
38887
  set pitchExecuted(value) {
38891
- assert_default()(value);
38888
+ if (!value) throw new Error("pitchExecuted should be true");
38892
38889
  this.loaderItem.pitchExecuted = true;
38893
38890
  }
38894
38891
  get normalExecuted() {
38895
38892
  return this.loaderItem.normalExecuted;
38896
38893
  }
38897
38894
  set normalExecuted(value) {
38898
- assert_default()(value);
38895
+ if (!value) throw new Error("normalExecuted should be true");
38899
38896
  this.loaderItem.normalExecuted = true;
38900
38897
  }
38901
38898
  set noPitch(value) {
38902
- assert_default()(value);
38899
+ if (!value) throw new Error("noPitch should be true");
38903
38900
  this.loaderItem.noPitch = true;
38904
38901
  }
38905
38902
  shouldYield() {
@@ -39205,7 +39202,7 @@ async function runLoaders(compiler, context) {
39205
39202
  loaderContext.utils = {
39206
39203
  absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
39207
39204
  contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
39208
- createHash: (type)=>createHash(type || compiler._lastCompilation.outputOptions.hashFunction)
39205
+ createHash: (type)=>createHash_createHash(type || compiler._lastCompilation.outputOptions.hashFunction)
39209
39206
  };
39210
39207
  loaderContext._compiler = compiler;
39211
39208
  loaderContext._compilation = compiler._lastCompilation;
@@ -39732,7 +39729,7 @@ function getRawResolveByDependency(byDependency) {
39732
39729
  ]));
39733
39730
  }
39734
39731
  function getRawTsConfig(tsConfig) {
39735
- assert_default()("string" != typeof tsConfig, "should resolve string tsConfig in normalization");
39732
+ if ("string" == typeof tsConfig) throw new Error("should resolve string tsConfig in normalization");
39736
39733
  if (void 0 === tsConfig) return tsConfig;
39737
39734
  const { configFile, references } = tsConfig;
39738
39735
  return {
@@ -39752,7 +39749,7 @@ function getRawResolve(resolve) {
39752
39749
  };
39753
39750
  }
39754
39751
  function getRawModule(module1, options) {
39755
- assert_default()(!isNil(module1.defaultRules), "module.defaultRules should not be nil after defaults");
39752
+ if (isNil(module1.defaultRules)) throw new Error("module.defaultRules should not be nil after defaults");
39756
39753
  const ruleSet = [
39757
39754
  {
39758
39755
  rules: module1.defaultRules
@@ -40083,7 +40080,7 @@ function getRawJsonGeneratorOptions(options) {
40083
40080
  }
40084
40081
  function getRawNode(node) {
40085
40082
  if (false === node) return;
40086
- assert_default()(!isNil(node.__dirname) && !isNil(node.global) && !isNil(node.__filename));
40083
+ if (isNil(node.__dirname) || isNil(node.global) || isNil(node.__filename)) throw new Error("node.__dirname, node.global, node.__filename should not be nil");
40087
40084
  return {
40088
40085
  dirname: String(node.__dirname),
40089
40086
  filename: String(node.__filename),
@@ -41012,7 +41009,7 @@ function SplitChunksPlugin_define_property(obj, key, value) {
41012
41009
  class SplitChunksPlugin extends RspackBuiltinPlugin {
41013
41010
  raw(compiler) {
41014
41011
  const rawOptions = toRawSplitChunksOptions(this.options, compiler);
41015
- assert_default()(void 0 !== rawOptions);
41012
+ if (void 0 === rawOptions) throw new Error("rawOptions should not be undefined");
41016
41013
  return createBuiltinPlugin(this.name, rawOptions);
41017
41014
  }
41018
41015
  constructor(options){
@@ -41218,7 +41215,8 @@ function getTagSrc(tag) {
41218
41215
  }
41219
41216
  }
41220
41217
  function computeIntegrity(hashFuncNames, source) {
41221
- const result = hashFuncNames.map((hashFuncName)=>`${hashFuncName}-${(0, crypto_browserify.createHash)(hashFuncName).update("string" == typeof source ? SubresourceIntegrityPlugin_Buffer.from(source, "utf-8") : source).digest("base64")}`).join(" ");
41218
+ const { createHash } = __webpack_require__("../../node_modules/.pnpm/crypto-browserify@3.12.1/node_modules/crypto-browserify/index.js");
41219
+ const result = hashFuncNames.map((hashFuncName)=>`${hashFuncName}-${createHash(hashFuncName).update("string" == typeof source ? SubresourceIntegrityPlugin_Buffer.from(source, "utf-8") : source).digest("base64")}`).join(" ");
41222
41220
  return result;
41223
41221
  }
41224
41222
  function normalizePath(path) {
@@ -42338,7 +42336,7 @@ const applyRspackOptionsDefaults = (options)=>{
42338
42336
  F(options, "context", ()=>defaults_process.cwd());
42339
42337
  F(options, "target", ()=>getDefaultTarget(options.context));
42340
42338
  const { mode, target } = options;
42341
- assert_default()(!isNil(target));
42339
+ if (isNil(target)) throw new Error("target should not be nil after defaults");
42342
42340
  const targetProperties = false === target ? false : "string" == typeof target ? getTargetProperties(target, options.context) : getTargetsProperties(target, options.context);
42343
42341
  const development = "development" === mode;
42344
42342
  const production = "production" === mode || !mode;
@@ -42464,7 +42462,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
42464
42462
  if ("object" == typeof rspackFuture) {
42465
42463
  D(rspackFuture, "bundlerInfo", {});
42466
42464
  if ("object" == typeof rspackFuture.bundlerInfo) {
42467
- D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-e3199f44-20251020173943");
42465
+ D(rspackFuture.bundlerInfo, "version", "1.6.0-canary-6cd722f4-20251022123039");
42468
42466
  D(rspackFuture.bundlerInfo, "bundler", "rspack");
42469
42467
  D(rspackFuture.bundlerInfo, "force", !library);
42470
42468
  }
@@ -43533,7 +43531,7 @@ function rmrf(fs, p, callback) {
43533
43531
  let count = files.length;
43534
43532
  if (0 === count) fs.rmdir(p, callback);
43535
43533
  else for (const file of files){
43536
- assert_default()("string" == typeof file);
43534
+ if ("string" != typeof file) throw new Error("file should be a string");
43537
43535
  const fullPath = join(fs, p, file);
43538
43536
  rmrf(fs, fullPath, (err)=>{
43539
43537
  if (err) return callback(err);
@@ -43942,7 +43940,7 @@ function getLazyHashedEtag_define_property(obj, key, value) {
43942
43940
  class LazyHashedEtag {
43943
43941
  toString() {
43944
43942
  if (void 0 === this._hash) {
43945
- const hash = createHash(this._hashFunction);
43943
+ const hash = createHash_createHash(this._hashFunction);
43946
43944
  this._obj.updateHash(hash);
43947
43945
  this._hash = hash.digest("base64");
43948
43946
  }
@@ -44765,7 +44763,7 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
44765
44763
  }, function(queried) {
44766
44764
  return function(chunk) {
44767
44765
  if (!getCompiler().options.output.hashFunction) throw new Error("'output.hashFunction' cannot be undefined");
44768
- const hash = createHash(getCompiler().options.output.hashFunction);
44766
+ const hash = createHash_createHash(getCompiler().options.output.hashFunction);
44769
44767
  queried.call(chunk, hash);
44770
44768
  let digestResult;
44771
44769
  digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest();
@@ -45083,7 +45081,7 @@ const createJavaScriptModulesHooksRegisters = (getCompiler, createTap)=>({
45083
45081
  }, function(queried) {
45084
45082
  return function(chunk) {
45085
45083
  if (!getCompiler().options.output.hashFunction) throw new Error("'output.hashFunction' cannot be undefined");
45086
- const hash = createHash(getCompiler().options.output.hashFunction);
45084
+ const hash = createHash_createHash(getCompiler().options.output.hashFunction);
45087
45085
  queried.call(chunk, hash);
45088
45086
  let digestResult;
45089
45087
  digestResult = getCompiler().options.output.hashDigest ? hash.digest(getCompiler().options.output.hashDigest) : hash.digest();
@@ -45526,7 +45524,7 @@ class Watching {
45526
45524
  for (const cb of callbacksToExecute)cb(err);
45527
45525
  };
45528
45526
  if (error) return handleError(error);
45529
- assert_default()(compilation);
45527
+ if (!compilation) throw new Error("compilation is required if no error");
45530
45528
  stats = new Stats(compilation);
45531
45529
  if (this.invalid && !this.suspended && !this.blocked && !(this.isBlocked() && (this.blocked = true))) return void Watching_class_private_method_get(this, _go, go).call(this);
45532
45530
  const startTime = this.startTime;
@@ -46420,7 +46418,7 @@ class MultiStats {
46420
46418
  return obj;
46421
46419
  });
46422
46420
  if (childOptions.version) {
46423
- obj.rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
46421
+ obj.rspackVersion = "1.6.0-canary-6cd722f4-20251022123039";
46424
46422
  obj.version = "5.75.0";
46425
46423
  }
46426
46424
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
@@ -47230,15 +47228,13 @@ const errorsSpaceLimit = (errors, max)=>{
47230
47228
  const DefaultStatsFactoryPlugin_compareIds = compareIds;
47231
47229
  const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/;
47232
47230
  const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/;
47233
- const ITEM_NAMES = {
47231
+ const SHARED_ITEM_NAMES = {
47234
47232
  "compilation.children[]": "compilation",
47235
47233
  "compilation.modules[]": "module",
47236
47234
  "compilation.entrypoints[]": "chunkGroup",
47237
47235
  "compilation.namedChunkGroups[]": "chunkGroup",
47238
47236
  "compilation.errors[]": "error",
47239
- "compilation.warnings[]": "warning",
47240
47237
  "chunk.modules[]": "module",
47241
- "chunk.rootModules[]": "module",
47242
47238
  "chunk.origins[]": "chunkOrigin",
47243
47239
  "compilation.chunks[]": "chunk",
47244
47240
  "compilation.assets[]": "asset",
@@ -47246,7 +47242,12 @@ const ITEM_NAMES = {
47246
47242
  "module.issuerPath[]": "moduleIssuer",
47247
47243
  "module.reasons[]": "moduleReason",
47248
47244
  "module.modules[]": "module",
47249
- "module.children[]": "module",
47245
+ "module.children[]": "module"
47246
+ };
47247
+ const ITEM_NAMES = {
47248
+ ...SHARED_ITEM_NAMES,
47249
+ "compilation.warnings[]": "warning",
47250
+ "chunk.rootModules[]": "module",
47250
47251
  "moduleTrace[]": "moduleTraceItem"
47251
47252
  };
47252
47253
  const MERGER = {
@@ -47691,6 +47692,7 @@ const SIMPLE_EXTRACTORS = {
47691
47692
  let currentList = rootList;
47692
47693
  let processedLogEntries = 0;
47693
47694
  for (const entry of logEntries){
47695
+ var _entry_args;
47694
47696
  let type = entry.type;
47695
47697
  const typeBitFlag = getLogTypeBitFlag(type);
47696
47698
  if (!debugMode && (acceptedTypes & typeBitFlag) !== typeBitFlag) continue;
@@ -47702,7 +47704,7 @@ const SIMPLE_EXTRACTORS = {
47702
47704
  if (depthInCollapsedGroup > 0) depthInCollapsedGroup--;
47703
47705
  continue;
47704
47706
  }
47705
- const message = entry.args && entry.args.length > 0 ? util.format(entry.args[0], ...entry.args.slice(1)) : "";
47707
+ const message = (null == (_entry_args = entry.args) ? void 0 : _entry_args.length) ? util.format(entry.args[0], ...entry.args.slice(1)) : "";
47706
47708
  const newEntry = {
47707
47709
  type,
47708
47710
  message,
@@ -47731,7 +47733,7 @@ const SIMPLE_EXTRACTORS = {
47731
47733
  },
47732
47734
  version: (object)=>{
47733
47735
  object.version = "5.75.0";
47734
- object.rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
47736
+ object.rspackVersion = "1.6.0-canary-6cd722f4-20251022123039";
47735
47737
  },
47736
47738
  env: (object, _compilation, _context, { _env })=>{
47737
47739
  object.env = _env;
@@ -47782,11 +47784,13 @@ const SIMPLE_EXTRACTORS = {
47782
47784
  }
47783
47785
  }
47784
47786
  }
47785
- object.assetsByChunkName = assetsByChunkName.reduce((acc, cur)=>{
47786
- acc[cur.name] = cur.files;
47787
- return acc;
47788
- }, {});
47789
- const groupedAssets = factory.create(`${type}.assets`, Array.from(assets), {
47787
+ object.assetsByChunkName = Object.fromEntries(assetsByChunkName.map(({ name, files })=>[
47788
+ name,
47789
+ files
47790
+ ]));
47791
+ const groupedAssets = factory.create(`${type}.assets`, [
47792
+ ...assets
47793
+ ], {
47790
47794
  ...context
47791
47795
  });
47792
47796
  const limited = spaceLimited(groupedAssets, options.assetsSpace ?? 1 / 0);
@@ -48002,16 +48006,14 @@ const SIMPLE_EXTRACTORS = {
48002
48006
  const { commonAttributes } = module1;
48003
48007
  object.source = commonAttributes.source;
48004
48008
  },
48005
- usedExports: (object, module1)=>{
48006
- if ("string" == typeof module1.usedExports) if ("null" === module1.usedExports) object.usedExports = null;
48007
- else object.usedExports = "true" === module1.usedExports;
48008
- else if (Array.isArray(module1.usedExports)) object.usedExports = module1.usedExports;
48009
+ usedExports: (object, { usedExports })=>{
48010
+ if ("string" == typeof usedExports) if ("null" === usedExports) object.usedExports = null;
48011
+ else object.usedExports = "true" === usedExports;
48012
+ else if (Array.isArray(usedExports)) object.usedExports = usedExports;
48009
48013
  else object.usedExports = null;
48010
48014
  },
48011
- providedExports: (object, module1)=>{
48012
- const { commonAttributes } = module1;
48013
- if (Array.isArray(commonAttributes.providedExports)) object.providedExports = commonAttributes.providedExports;
48014
- else object.providedExports = null;
48015
+ providedExports: (object, { commonAttributes })=>{
48016
+ object.providedExports = Array.isArray(commonAttributes.providedExports) ? commonAttributes.providedExports : null;
48015
48017
  },
48016
48018
  optimizationBailout: (object, module1)=>{
48017
48019
  object.optimizationBailout = module1.commonAttributes.optimizationBailout || null;
@@ -48164,7 +48166,6 @@ const FILTER = {
48164
48166
  }
48165
48167
  }
48166
48168
  };
48167
- const FILTER_RESULTS = {};
48168
48169
  class DefaultStatsFactoryPlugin {
48169
48170
  apply(compiler) {
48170
48171
  compiler.hooks.compilation.tap("DefaultStatsFactoryPlugin", (compilation)=>{
@@ -48175,9 +48176,6 @@ class DefaultStatsFactoryPlugin {
48175
48176
  iterateConfig(FILTER, options, (hookFor, fn)=>{
48176
48177
  stats.hooks.filter.for(hookFor).tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i)=>fn(item, ctx, options, idx, i));
48177
48178
  });
48178
- iterateConfig(FILTER_RESULTS, options, (hookFor, fn)=>{
48179
- stats.hooks.filterResults.for(hookFor).tap("DefaultStatsFactoryPlugin", (item, ctx, idx, i)=>fn(item, ctx, options, idx, i));
48180
- });
48181
48179
  iterateConfig(SORTERS, options, (hookFor, fn)=>{
48182
48180
  stats.hooks.sort.for(hookFor).tap("DefaultStatsFactoryPlugin", (comparators, ctx)=>fn(comparators, ctx, options));
48183
48181
  });
@@ -48720,16 +48718,9 @@ const SIMPLE_PRINTERS = {
48720
48718
  "moduleTraceDependency.loc": (loc)=>loc
48721
48719
  };
48722
48720
  const DefaultStatsPrinterPlugin_ITEM_NAMES = {
48723
- "compilation.assets[]": "asset",
48724
- "compilation.modules[]": "module",
48725
- "compilation.chunks[]": "chunk",
48726
- "compilation.entrypoints[]": "chunkGroup",
48727
- "compilation.namedChunkGroups[]": "chunkGroup",
48728
- "compilation.errors[]": "error",
48721
+ ...SHARED_ITEM_NAMES,
48729
48722
  "compilation.warnings[]": "error",
48730
48723
  "compilation.logging[]": "loggingGroup",
48731
- "compilation.children[]": "compilation",
48732
- "asset.related[]": "asset",
48733
48724
  "asset.children[]": "asset",
48734
48725
  "asset.chunks[]": "assetChunk",
48735
48726
  "asset.auxiliaryChunks[]": "assetChunk",
@@ -48743,13 +48734,7 @@ const DefaultStatsPrinterPlugin_ITEM_NAMES = {
48743
48734
  "chunkGroupChild.auxiliaryAssets[]": "chunkGroupAsset",
48744
48735
  "chunkGroup.children[]": "chunkGroupChildGroup",
48745
48736
  "chunkGroupChildGroup.children[]": "chunkGroupChild",
48746
- "module.modules[]": "module",
48747
- "module.children[]": "module",
48748
- "module.reasons[]": "moduleReason",
48749
48737
  "moduleReason.children[]": "moduleReason",
48750
- "module.issuerPath[]": "moduleIssuer",
48751
- "chunk.origins[]": "chunkOrigin",
48752
- "chunk.modules[]": "module",
48753
48738
  "loggingGroup.entries[]": (logEntry)=>`loggingEntry(${logEntry.type}).loggingEntry`,
48754
48739
  "loggingEntry.children[]": (logEntry)=>`loggingEntry(${logEntry.type}).loggingEntry`,
48755
48740
  "error.moduleTrace[]": "moduleTraceItem",
@@ -49233,10 +49218,6 @@ const AVAILABLE_FORMATS = {
49233
49218
  regExp: /(Did you mean .+)/g,
49234
49219
  format: green
49235
49220
  },
49236
- {
49237
- regExp: /(Set 'mode' option to 'development' or 'production')/g,
49238
- format: green
49239
- },
49240
49221
  {
49241
49222
  regExp: /(\(module has no exports\))/g,
49242
49223
  format: red
@@ -49249,10 +49230,6 @@ const AVAILABLE_FORMATS = {
49249
49230
  regExp: /(?:^|\n)(.* doesn't exist)/g,
49250
49231
  format: red
49251
49232
  },
49252
- {
49253
- regExp: /('\w+' option has not been set)/g,
49254
- format: red
49255
- },
49256
49233
  {
49257
49234
  regExp: /(Emitted value instead of an instance of Error)/g,
49258
49235
  format: yellow
@@ -49337,12 +49314,12 @@ class DefaultStatsPrinterPlugin {
49337
49314
  }
49338
49315
  class RspackOptionsApply {
49339
49316
  process(options, compiler) {
49340
- assert_default()(options.output.path, "options.output.path should have value after `applyRspackOptionsDefaults`");
49317
+ if (!options.output.path) throw new Error("options.output.path should have a value after `applyRspackOptionsDefaults`");
49341
49318
  compiler.outputPath = options.output.path;
49342
49319
  compiler.name = options.name;
49343
49320
  compiler.outputFileSystem = browser_fs["default"];
49344
49321
  if (options.externals) {
49345
- assert_default()(options.externalsType, "options.externalsType should have value after `applyRspackOptionsDefaults`");
49322
+ if (!options.externalsType) throw new Error("options.externalsType should have a value after `applyRspackOptionsDefaults`");
49346
49323
  new ExternalsPlugin(options.externalsType, options.externals, false).apply(compiler);
49347
49324
  }
49348
49325
  if (options.externalsPresets.node) new NodeTargetPlugin().apply(compiler);
@@ -49404,7 +49381,7 @@ class RspackOptionsApply {
49404
49381
  new AssetModulesPlugin().apply(compiler);
49405
49382
  if (options.experiments.asyncWebAssembly) new AsyncWebAssemblyModulesPlugin().apply(compiler);
49406
49383
  if (options.experiments.css) new CssModulesPlugin().apply(compiler);
49407
- new lib_EntryOptionPlugin().apply(compiler);
49384
+ new EntryOptionPlugin().apply(compiler);
49408
49385
  assertNotNill(options.context);
49409
49386
  compiler.hooks.entryOption.call(options.context, options.entry);
49410
49387
  new RuntimePlugin().apply(compiler);
@@ -50753,7 +50730,7 @@ function transformSync(source, options) {
50753
50730
  const _options = JSON.stringify(options || {});
50754
50731
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
50755
50732
  }
50756
- const exports_rspackVersion = "1.6.0-canary-e3199f44-20251020173943";
50733
+ const exports_rspackVersion = "1.6.0-canary-6cd722f4-20251022123039";
50757
50734
  const exports_version = "5.75.0";
50758
50735
  const exports_WebpackError = Error;
50759
50736
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -50764,7 +50741,7 @@ const exports_config = {
50764
50741
  applyWebpackOptionsDefaults: applyRspackOptionsDefaults
50765
50742
  };
50766
50743
  const exports_util = {
50767
- createHash: createHash,
50744
+ createHash: createHash_createHash,
50768
50745
  cleverMerge: cachedCleverMerge
50769
50746
  };
50770
50747
  const web = {
@@ -50889,7 +50866,7 @@ function createMultiCompiler(options) {
50889
50866
  function createCompiler(userOptions) {
50890
50867
  const options = getNormalizedRspackOptions(userOptions);
50891
50868
  applyRspackOptionsBaseDefaults(options);
50892
- assert_default()(!isNil(options.context));
50869
+ if (isNil(options.context)) throw new Error("options.context is required");
50893
50870
  const compiler = new Compiler(options.context, options);
50894
50871
  new NodeEnvironmentPlugin({
50895
50872
  infrastructureLogging: options.infrastructureLogging
@@ -51160,4 +51137,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
51160
51137
  var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
51161
51138
  var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
51162
51139
  var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
51163
- export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, exports_library as library, exports_node as node, optimize, src_rspack as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
51140
+ export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, exports_library as library, exports_node as node, optimize, src_rspack as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
@@ -1,5 +1,11 @@
1
1
  import WebpackError from "../lib/WebpackError";
2
- export default class ModuleError extends WebpackError {
2
+ export declare class ModuleError extends WebpackError {
3
+ error?: Error;
4
+ constructor(err: Error, { from }?: {
5
+ from?: string;
6
+ });
7
+ }
8
+ export declare class ModuleWarning extends WebpackError {
3
9
  error?: Error;
4
10
  constructor(err: Error, { from }?: {
5
11
  from?: string;
@@ -2087,6 +2087,10 @@ export interface RawEnvironment {
2087
2087
  dynamicImportInWorker?: boolean
2088
2088
  }
2089
2089
 
2090
+ export interface RawEsmLibraryPlugin {
2091
+ preserveModules?: string
2092
+ }
2093
+
2090
2094
  export interface RawEvalDevToolModulePluginOptions {
2091
2095
  namespace?: string
2092
2096
  moduleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string)
Binary file
@@ -1,4 +1,20 @@
1
1
  import type { Compiler } from "../Compiler";
2
+ export declare const SHARED_ITEM_NAMES: {
3
+ "compilation.children[]": string;
4
+ "compilation.modules[]": string;
5
+ "compilation.entrypoints[]": string;
6
+ "compilation.namedChunkGroups[]": string;
7
+ "compilation.errors[]": string;
8
+ "chunk.modules[]": string;
9
+ "chunk.origins[]": string;
10
+ "compilation.chunks[]": string;
11
+ "compilation.assets[]": string;
12
+ "asset.related[]": string;
13
+ "module.issuerPath[]": string;
14
+ "module.reasons[]": string;
15
+ "module.modules[]": string;
16
+ "module.children[]": string;
17
+ };
2
18
  export declare class DefaultStatsFactoryPlugin {
3
19
  apply(compiler: Compiler): void;
4
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/browser",
3
- "version": "1.6.0-canary-e3199f44-20251020173943",
3
+ "version": "1.6.0-canary-6cd722f4-20251022123039",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "Rspack for running in the browser. This is still in early stage and may not follow the semver.",
@@ -1,7 +0,0 @@
1
- import WebpackError from "../lib/WebpackError";
2
- export default class ModuleWarning extends WebpackError {
3
- error?: Error;
4
- constructor(err: Error, { from }?: {
5
- from?: string;
6
- });
7
- }