@rspack/core 1.3.10 → 1.3.11

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.
@@ -27,7 +27,7 @@ import { type RspackError } from "./RspackError";
27
27
  import { RuntimeModule } from "./RuntimeModule";
28
28
  import { Stats, type StatsAsset, type StatsError, type StatsModule } from "./Stats";
29
29
  import type { EntryOptions, EntryPlugin } from "./builtin-plugin";
30
- import type { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";
30
+ import type { OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";
31
31
  import WebpackError from "./lib/WebpackError";
32
32
  import { Logger } from "./logging/Logger";
33
33
  import { StatsFactory } from "./stats/StatsFactory";
@@ -284,10 +284,10 @@ export declare class Compilation {
284
284
  set errors(errors: RspackError[]);
285
285
  get warnings(): RspackError[];
286
286
  set warnings(warnings: RspackError[]);
287
- getPath(filename: Filename, data?: PathData): string;
288
- getPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
289
- getAssetPath(filename: Filename, data?: PathData): string;
290
- getAssetPathWithInfo(filename: Filename, data?: PathData): binding.PathWithInfo;
287
+ getPath(filename: string, data?: PathData): string;
288
+ getPathWithInfo(filename: string, data?: PathData): binding.PathWithInfo;
289
+ getAssetPath(filename: string, data?: PathData): string;
290
+ getAssetPathWithInfo(filename: string, data?: PathData): binding.PathWithInfo;
291
291
  getLogger(name: string | (() => string)): Logger;
292
292
  fileDependencies: {
293
293
  [Symbol.iterator](): Generator<string, void, unknown>;
@@ -0,0 +1,7 @@
1
+ import type { Diagnostics } from "@rspack/binding";
2
+ import type { RspackError } from "./RspackError";
3
+ declare const $proxy: unique symbol;
4
+ export declare function createDiagnosticArray(adm: Diagnostics & {
5
+ [$proxy]?: RspackError[];
6
+ }): RspackError[];
7
+ export {};
package/dist/Module.d.ts CHANGED
@@ -42,6 +42,15 @@ export declare class ContextModuleFactoryAfterResolveData {
42
42
  private constructor();
43
43
  }
44
44
  export type ContextModuleFactoryAfterResolveResult = false | ContextModuleFactoryAfterResolveData;
45
+ declare const $assets: unique symbol;
46
+ declare module "@rspack/binding" {
47
+ interface Assets {
48
+ [$assets]: Record<string, Source>;
49
+ }
50
+ interface BuildInfo {
51
+ assets: Record<string, Source>;
52
+ }
53
+ }
45
54
  declare module "@rspack/binding" {
46
55
  interface Module {
47
56
  identifier(): string;
@@ -7,3 +7,6 @@ export declare class JsRspackDiagnostic {
7
7
  export declare class NonErrorEmittedError extends Error {
8
8
  constructor(error: Error);
9
9
  }
10
+ export declare class DeadlockRiskError extends Error {
11
+ constructor(message: string);
12
+ }
@@ -0,0 +1,19 @@
1
+ import * as binding from "@rspack/binding";
2
+ export interface CssChunkingPluginOptions {
3
+ strict?: boolean;
4
+ /**
5
+ * This plugin is intended to be generic, but currently requires some special handling for Next.js.
6
+ * A `next` option has been added to accommodate this.
7
+ * In the future, once the design of CssChunkingPlugin becomes more stable, this option may be removed.
8
+ */
9
+ nextjs?: boolean;
10
+ }
11
+ export declare const CssChunkingPlugin: {
12
+ new (options: CssChunkingPluginOptions): {
13
+ name: binding.BuiltinPluginName;
14
+ _args: [options: CssChunkingPluginOptions];
15
+ affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
16
+ raw(compiler: import("..").Compiler): binding.BuiltinPlugin;
17
+ apply(compiler: import("..").Compiler): void;
18
+ };
19
+ };
@@ -10,7 +10,7 @@ export declare const DefinePlugin: {
10
10
  };
11
11
  };
12
12
  type CodeValue = RecursiveArrayOrRecord<CodeValuePrimitive>;
13
- type CodeValuePrimitive = null | undefined | RegExp | Function | string | number | boolean | bigint | undefined;
13
+ type CodeValuePrimitive = null | undefined | RegExp | Function | string | number | boolean | bigint;
14
14
  type RecursiveArrayOrRecord<T> = {
15
15
  [index: string]: RecursiveArrayOrRecord<T>;
16
16
  } | Array<RecursiveArrayOrRecord<T>> | T;
@@ -1,8 +1,8 @@
1
- import { BuiltinPluginName, type RawSourceMapDevToolPluginOptions } from "@rspack/binding";
1
+ import { BuiltinPluginName, type SourceMapDevToolPluginOptions } from "@rspack/binding";
2
2
  export declare const EvalSourceMapDevToolPlugin: {
3
- new (options: RawSourceMapDevToolPluginOptions): {
3
+ new (options: SourceMapDevToolPluginOptions): {
4
4
  name: BuiltinPluginName;
5
- _args: [options: RawSourceMapDevToolPluginOptions];
5
+ _args: [options: SourceMapDevToolPluginOptions];
6
6
  affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
7
7
  raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
8
8
  apply(compiler: import("..").Compiler): void;
@@ -1,9 +1,9 @@
1
- import { BuiltinPluginName, type RawSourceMapDevToolPluginOptions } from "@rspack/binding";
2
- export type { RawSourceMapDevToolPluginOptions as SourceMapDevToolPluginOptions };
1
+ import { BuiltinPluginName, type SourceMapDevToolPluginOptions } from "@rspack/binding";
2
+ export type { SourceMapDevToolPluginOptions };
3
3
  export declare const SourceMapDevToolPlugin: {
4
- new (options: RawSourceMapDevToolPluginOptions): {
4
+ new (options: SourceMapDevToolPluginOptions): {
5
5
  name: BuiltinPluginName;
6
- _args: [options: RawSourceMapDevToolPluginOptions];
6
+ _args: [options: SourceMapDevToolPluginOptions];
7
7
  affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
8
8
  raw(compiler: import("..").Compiler): import("@rspack/binding").BuiltinPlugin;
9
9
  apply(compiler: import("..").Compiler): void;
@@ -75,3 +75,4 @@ export * from "./DllReferenceAgencyPlugin";
75
75
  export * from "./RsdoctorPlugin";
76
76
  export * from "./SubresourceIntegrityPlugin";
77
77
  export * from "./ModuleInfoHeaderPlugin";
78
+ export * from "./CssChunkingPlugin";
@@ -1014,9 +1014,9 @@ export declare const rspackOptions: z.ZodObject<{
1014
1014
  body: Buffer<ArrayBufferLike>;
1015
1015
  headers: Record<string, string>;
1016
1016
  }>) | undefined;
1017
+ upgrade?: boolean | undefined;
1017
1018
  lockfileLocation?: string | undefined;
1018
1019
  cacheLocation?: string | false | undefined;
1019
- upgrade?: boolean | undefined;
1020
1020
  }, {
1021
1021
  allowedUris: (string | RegExp)[];
1022
1022
  httpClient?: ((args_0: string, args_1: Record<string, string>, ...args: unknown[]) => Promise<{
@@ -1024,9 +1024,9 @@ export declare const rspackOptions: z.ZodObject<{
1024
1024
  body: Buffer<ArrayBufferLike>;
1025
1025
  headers: Record<string, string>;
1026
1026
  }>) | undefined;
1027
+ upgrade?: boolean | undefined;
1027
1028
  lockfileLocation?: string | undefined;
1028
1029
  cacheLocation?: string | false | undefined;
1029
- upgrade?: boolean | undefined;
1030
1030
  }>>;
1031
1031
  parallelLoader: z.ZodOptional<z.ZodBoolean>;
1032
1032
  }, "strict", z.ZodTypeAny, {
@@ -1092,9 +1092,9 @@ export declare const rspackOptions: z.ZodObject<{
1092
1092
  body: Buffer<ArrayBufferLike>;
1093
1093
  headers: Record<string, string>;
1094
1094
  }>) | undefined;
1095
+ upgrade?: boolean | undefined;
1095
1096
  lockfileLocation?: string | undefined;
1096
1097
  cacheLocation?: string | false | undefined;
1097
- upgrade?: boolean | undefined;
1098
1098
  } | undefined;
1099
1099
  parallelLoader?: boolean | undefined;
1100
1100
  }, {
@@ -1160,9 +1160,9 @@ export declare const rspackOptions: z.ZodObject<{
1160
1160
  body: Buffer<ArrayBufferLike>;
1161
1161
  headers: Record<string, string>;
1162
1162
  }>) | undefined;
1163
+ upgrade?: boolean | undefined;
1163
1164
  lockfileLocation?: string | undefined;
1164
1165
  cacheLocation?: string | false | undefined;
1165
- upgrade?: boolean | undefined;
1166
1166
  } | undefined;
1167
1167
  parallelLoader?: boolean | undefined;
1168
1168
  }>>;
@@ -3487,9 +3487,9 @@ export declare const rspackOptions: z.ZodObject<{
3487
3487
  body: Buffer<ArrayBufferLike>;
3488
3488
  headers: Record<string, string>;
3489
3489
  }>) | undefined;
3490
+ upgrade?: boolean | undefined;
3490
3491
  lockfileLocation?: string | undefined;
3491
3492
  cacheLocation?: string | false | undefined;
3492
- upgrade?: boolean | undefined;
3493
3493
  } | undefined;
3494
3494
  parallelLoader?: boolean | undefined;
3495
3495
  } | undefined;
@@ -4109,9 +4109,9 @@ export declare const rspackOptions: z.ZodObject<{
4109
4109
  body: Buffer<ArrayBufferLike>;
4110
4110
  headers: Record<string, string>;
4111
4111
  }>) | undefined;
4112
+ upgrade?: boolean | undefined;
4112
4113
  lockfileLocation?: string | undefined;
4113
4114
  cacheLocation?: string | false | undefined;
4114
- upgrade?: boolean | undefined;
4115
4115
  } | undefined;
4116
4116
  parallelLoader?: boolean | undefined;
4117
4117
  } | undefined;
package/dist/exports.d.ts CHANGED
@@ -116,6 +116,7 @@ import { RuntimeChunkPlugin } from "./builtin-plugin";
116
116
  import { SplitChunksPlugin } from "./builtin-plugin";
117
117
  import { RemoveDuplicateModulesPlugin } from "./builtin-plugin";
118
118
  import { RsdoctorPlugin } from "./builtin-plugin";
119
+ import { CssChunkingPlugin } from "./builtin-plugin";
119
120
  interface Optimize {
120
121
  LimitChunkCountPlugin: typeof LimitChunkCountPlugin;
121
122
  RuntimeChunkPlugin: typeof RuntimeChunkPlugin;
@@ -183,5 +184,6 @@ interface Experiments {
183
184
  transform: typeof transform;
184
185
  minify: typeof minify;
185
186
  };
187
+ CssChunkingPlugin: typeof CssChunkingPlugin;
186
188
  }
187
189
  export declare const experiments: Experiments;
package/dist/index.js CHANGED
@@ -225,6 +225,12 @@ var __webpack_modules__ = {
225
225
  "node:child_process": function(module) {
226
226
  module.exports = require("node:child_process");
227
227
  },
228
+ "node:http": function(module) {
229
+ module.exports = require("node:http");
230
+ },
231
+ "node:https": function(module) {
232
+ module.exports = require("node:https");
233
+ },
228
234
  "node:os": function(module) {
229
235
  module.exports = require("node:os");
230
236
  },
@@ -765,6 +771,11 @@ for(var __webpack_i__ in (()=>{
765
771
  super(), this.name = "NonErrorEmittedError", this.message = `(Emitted value instead of an instance of Error) ${error}`;
766
772
  }
767
773
  }
774
+ class DeadlockRiskError extends Error {
775
+ constructor(message){
776
+ super(message), this.name = "DeadlockRiskError", this.stack = "";
777
+ }
778
+ }
768
779
  class RuntimeModule {
769
780
  static STAGE_NORMAL = 0;
770
781
  static STAGE_BASIC = 5;
@@ -863,6 +874,7 @@ for(var __webpack_i__ in (()=>{
863
874
  getInner: this.#getInnerByCompilation.bind(this)
864
875
  });
865
876
  } catch (e) {
877
+ if (e instanceof DeadlockRiskError) throw e;
866
878
  console.warn(`Failed to get stats due to error: ${e?.message}, are you trying to access the stats from the previous compilation?`);
867
879
  }
868
880
  return stats;
@@ -882,6 +894,7 @@ for(var __webpack_i__ in (()=>{
882
894
  getInner: this.#getInnerByCompilation.bind(this)
883
895
  });
884
896
  } catch (e) {
897
+ if (e instanceof DeadlockRiskError) throw e;
885
898
  console.warn(`Failed to get stats due to error: ${e?.message}, are you trying to access the stats from the previous compilation?`);
886
899
  }
887
900
  if (!stats) return "";
@@ -1536,13 +1549,15 @@ for(var __webpack_i__ in (()=>{
1536
1549
  return originalSource ? JsSource.__from_binding(originalSource) : null;
1537
1550
  }
1538
1551
  });
1539
- let checkCompilation = (compilation)=>{
1552
+ let $proxy = Symbol.for("proxy"), checkCompilation = (compilation)=>{
1540
1553
  if (!(compilation instanceof Compilation)) throw TypeError('The \'compilation\' argument must be an instance of Compilation. This usually occurs when multiple versions of "@rspack/core" are used, or when the code in "@rspack/core" is executed multiple times.');
1541
1554
  };
1542
1555
  Compilation_computedKey = binding_.COMPILATION_HOOKS_MAP_SYMBOL;
1543
1556
  class Compilation {
1544
1557
  #inner;
1545
1558
  #shutdown;
1559
+ #errors;
1560
+ #chunks;
1546
1561
  hooks;
1547
1562
  name;
1548
1563
  startTime;
@@ -1725,7 +1740,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1725
1740
  return new Set(this.#inner.builtModules);
1726
1741
  }
1727
1742
  get chunks() {
1728
- return this.#inner.chunks;
1743
+ return this.#chunks || (this.#chunks = this.#inner.chunks), this.#chunks;
1729
1744
  }
1730
1745
  get namedChunks() {
1731
1746
  return createReadonlyMap({
@@ -1828,51 +1843,55 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
1828
1843
  this.#inner.pushNativeDiagnostics(diagnostics);
1829
1844
  }
1830
1845
  get errors() {
1831
- let inner = this.#inner, errors = inner.getErrors();
1832
- for (let item of [
1833
- {
1834
- method: "push",
1835
- handler (target, thisArg, errs) {
1836
- for(let i = 0; i < errs.length; i++){
1837
- let error = errs[i];
1838
- inner.pushDiagnostic(JsRspackDiagnostic.__to_binding(error, binding_.JsRspackSeverity.Error));
1839
- }
1840
- return Reflect.apply(target, thisArg, errs);
1841
- }
1842
- },
1843
- {
1844
- method: "pop",
1845
- handler: (target, thisArg)=>(inner.spliceDiagnostic(errors.length - 1, errors.length, []), Reflect.apply(target, thisArg, []))
1846
- },
1847
- {
1848
- method: "shift",
1849
- handler: (target, thisArg)=>(inner.spliceDiagnostic(0, 1, []), Reflect.apply(target, thisArg, []))
1850
- },
1851
- {
1852
- method: "unshift",
1853
- handler (target, thisArg, errs) {
1854
- let errList = errs.map((error)=>JsRspackDiagnostic.__to_binding(error, binding_.JsRspackSeverity.Error));
1855
- return inner.spliceDiagnostic(0, 0, errList), Reflect.apply(target, thisArg, errs);
1846
+ return this.#errors || (this.#errors = function(adm) {
1847
+ if ($proxy in adm) return adm[$proxy];
1848
+ let array = [];
1849
+ array[external_node_util_default().inspect.custom] = ()=>adm.values();
1850
+ let splice = function(index, deleteCount, ...newItems) {
1851
+ switch(arguments.length){
1852
+ case 0:
1853
+ return [];
1854
+ case 1:
1855
+ return adm.spliceWithArray(index, adm.length);
1856
+ case 2:
1857
+ return adm.spliceWithArray(index, deleteCount);
1856
1858
  }
1857
- },
1858
- {
1859
- method: "splice",
1860
- handler (target, thisArg, [startIdx, delCount, ...errors]) {
1861
- let errList = errors.map((error)=>JsRspackDiagnostic.__to_binding(error, binding_.JsRspackSeverity.Error));
1862
- return inner.spliceDiagnostic(startIdx, startIdx + delCount, errList), Reflect.apply(target, thisArg, [
1863
- startIdx,
1864
- delCount,
1865
- ...errors
1866
- ]);
1859
+ return adm.spliceWithArray(index, deleteCount, newItems.map((item)=>concatErrorMsgAndStack(item)));
1860
+ }, arrayExtensions = {
1861
+ [Symbol.iterator]: ()=>adm.values().values(),
1862
+ splice,
1863
+ push: (...newItems)=>(adm.spliceWithArray(adm.length, 0, newItems.map((item)=>concatErrorMsgAndStack(item))), adm.length),
1864
+ pop: ()=>splice(Math.max(adm.length - 1, 0), 1)[0],
1865
+ shift: ()=>splice(0, 1)[0],
1866
+ unshift: (...newItems)=>(adm.spliceWithArray(0, 0, newItems.map((item)=>concatErrorMsgAndStack(item))), adm.length),
1867
+ reverse: ()=>adm.values().reverse(),
1868
+ sort (compareFn) {
1869
+ let copy = adm.values();
1870
+ return copy.sort(compareFn), adm.spliceWithArray(0, adm.length, copy), this;
1871
+ },
1872
+ at: (index)=>adm.get(index),
1873
+ concat: (...items)=>([].includes, adm.values().concat(...items)),
1874
+ flat: ()=>adm.values(),
1875
+ every: (predicate, thisArg)=>adm.values().every(predicate, thisArg),
1876
+ filter: (predicate, thisArg)=>adm.values().filter(predicate, thisArg),
1877
+ find: (predicate, thisArg)=>adm.values().find(predicate, thisArg),
1878
+ findIndex: (predicate, thisArg)=>adm.values().findIndex(predicate, thisArg),
1879
+ flatMap: (callbackfn, thisArg)=>adm.values().flatMap(callbackfn, thisArg),
1880
+ forEach (callbackfn, thisArg) {
1881
+ adm.values().forEach(callbackfn, thisArg);
1882
+ },
1883
+ map: (callbackfn, thisArg)=>adm.values().map(callbackfn, thisArg),
1884
+ reduce: (callbackfn, initialValue)=>adm.values().reduce(callbackfn, initialValue),
1885
+ reduceRight: (callbackfn, initialValue)=>adm.values().reduceRight(callbackfn, initialValue)
1886
+ }, proxy = new Proxy(array, {
1887
+ get: (target, name)=>"length" === name ? adm.length : "string" != typeof name || Number.isNaN(Number.parseInt(name)) ? Object.prototype.hasOwnProperty.call(arrayExtensions, name) ? arrayExtensions[name] : target[name] : adm.get(Number.parseInt(name)),
1888
+ set (target, name, value) {
1889
+ if ("length" === name) throw Error("The 'length' property is read-only and cannot be assigned a new value.");
1890
+ return "symbol" == typeof name || Number.isNaN(Number.parseInt(name)) ? target[name] = value : adm.set(Number.parseInt(name), concatErrorMsgAndStack(value)), !0;
1867
1891
  }
1868
- }
1869
- ]){
1870
- let proxiedMethod = new Proxy(errors[item.method], {
1871
- apply: item.handler
1872
1892
  });
1873
- errors[item.method] = proxiedMethod;
1874
- }
1875
- return errors;
1893
+ return adm[$proxy] = proxy, proxy;
1894
+ }(this.#inner.errors)), this.#errors;
1876
1895
  }
1877
1896
  set errors(errors) {
1878
1897
  let inner = this.#inner, length = inner.getErrors().length;
@@ -3091,6 +3110,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3091
3110
  static layer;
3092
3111
  static output;
3093
3112
  static session;
3113
+ static counter = 100;
3094
3114
  static async initJavaScriptTrace(layer, output) {
3095
3115
  let { Session } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:inspector"));
3096
3116
  this.session = new Session(), this.layer = layer, this.output = output, this.events = [];
@@ -3767,7 +3787,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3767
3787
  else {
3768
3788
  var args1, raw;
3769
3789
  loaderState === binding_.JsLoaderState.Normal && (args1 = args, !(raw = !!currentLoaderObject?.raw) && args1[0] instanceof Uint8Array ? args1[0] = function(buf) {
3770
- let str = decoder.decode(buf);
3790
+ let str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf);
3771
3791
  return 0xfeff === str.charCodeAt(0) ? str.slice(1) : str;
3772
3792
  }(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))), result = await utils_runSyncOrAsync(fn, loaderContext, args) || [];
3773
3793
  }
@@ -3822,7 +3842,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3822
3842
  additionalData
3823
3843
  ], context.resourceData));
3824
3844
  }
3825
- context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = JsSourceMap.__to_binding(sourceMap), context.additionalData = additionalData || void 0;
3845
+ context.content = isNil(content) ? null : toBuffer(content), context.sourceMap = JsSourceMap.__to_binding(sourceMap), context.additionalData = additionalData || void 0, context.__internal__utf8Hint = "string" == typeof content;
3826
3846
  break;
3827
3847
  }
3828
3848
  default:
@@ -4449,9 +4469,13 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
4449
4469
  let ret = {
4450
4470
  patterns: []
4451
4471
  };
4452
- return ret.patterns = (copy.patterns || []).map((pattern)=>("string" == typeof pattern && (pattern = {
4472
+ return ret.patterns = (copy.patterns || []).map((pattern)=>{
4473
+ "string" == typeof pattern && (pattern = {
4453
4474
  from: pattern
4454
- }), pattern.force ??= !1, pattern.noErrorOnMissing ??= !1, pattern.priority ??= 0, pattern.globOptions ??= {}, pattern.copyPermissions ??= !1, pattern)), ret;
4475
+ }), pattern.force ??= !1, pattern.noErrorOnMissing ??= !1, pattern.priority ??= 0, pattern.globOptions ??= {}, pattern.copyPermissions ??= !1;
4476
+ let originalTransform = pattern.transform;
4477
+ return originalTransform && ("object" == typeof originalTransform ? pattern.transform = (input, absoluteFilename)=>Promise.resolve(originalTransform.transformer(input, absoluteFilename)) : pattern.transform = (input, absoluteFilename)=>Promise.resolve(originalTransform(input, absoluteFilename))), pattern;
4478
+ }), ret;
4455
4479
  }), DEFAULT_FILENAME = "[name].css", LOADER_PATH = (0, external_node_path_namespaceObject.join)(__dirname, "cssExtractLoader.js");
4456
4480
  class CssExtractRspackPlugin {
4457
4481
  static pluginName = "css-extract-rspack-plugin";
@@ -4635,15 +4659,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4635
4659
  if (!enabled.has(type)) return enabled.add(type), createBuiltinPlugin(this.name, type);
4636
4660
  }
4637
4661
  }
4638
- let EnableWasmLoadingPlugin = base_create(binding_.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), EvalDevToolModulePlugin = base_create(binding_.BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, "compilation"), EvalSourceMapDevToolPlugin = base_create(binding_.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>({
4639
- filename: options.filename || void 0,
4640
- append: options.append,
4641
- namespace: options.namespace ?? "",
4642
- columns: options.columns ?? !0,
4643
- noSources: options.noSources ?? !1,
4644
- publicPath: options.publicPath,
4645
- module: options.module
4646
- }), "compilation");
4662
+ let EnableWasmLoadingPlugin = base_create(binding_.BuiltinPluginName.EnableWasmLoadingPlugin, (type)=>type), EnsureChunkConditionsPlugin = base_create(binding_.BuiltinPluginName.EnsureChunkConditionsPlugin, ()=>{}), EvalDevToolModulePlugin = base_create(binding_.BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, "compilation"), EvalSourceMapDevToolPlugin = base_create(binding_.BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>options, "compilation");
4647
4663
  class ExternalsPlugin extends RspackBuiltinPlugin {
4648
4664
  type;
4649
4665
  externals;
@@ -5073,18 +5089,36 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5073
5089
  let HttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.HttpExternalsRspackPlugin, (css, webAsync)=>({
5074
5090
  css,
5075
5091
  webAsync
5076
- })), defaultHttpClient = (url, headers)=>fetch(url, {
5092
+ })), external_node_zlib_namespaceObject = require("node:zlib"), getHttp = memoize(()=>__webpack_require__("node:http")), getHttps = memoize(()=>__webpack_require__("node:https")), defaultHttpClient = async (url, headers)=>{
5093
+ let { res, body } = await function(url, options) {
5094
+ let send = "https:" === new URL(url).protocol ? getHttps() : getHttp();
5095
+ return new Promise((resolve, reject)=>{
5096
+ send.get(url, options, (res)=>{
5097
+ let contentEncoding = res.headers["content-encoding"], stream = res;
5098
+ "gzip" === contentEncoding ? stream = stream.pipe((0, external_node_zlib_namespaceObject.createGunzip)()) : "br" === contentEncoding ? stream = stream.pipe((0, external_node_zlib_namespaceObject.createBrotliDecompress)()) : "deflate" === contentEncoding && (stream = stream.pipe((0, external_node_zlib_namespaceObject.createInflate)()));
5099
+ let chunks = [];
5100
+ stream.on("data", (chunk)=>{
5101
+ chunks.push(chunk);
5102
+ }), stream.on("end", ()=>{
5103
+ let bodyBuffer = Buffer.concat(chunks);
5104
+ if (!res.complete) return void reject(Error(`${url} request was terminated early`));
5105
+ resolve({
5106
+ res,
5107
+ body: bodyBuffer
5108
+ });
5109
+ });
5110
+ }).on("error", reject);
5111
+ });
5112
+ }(url, {
5077
5113
  headers
5078
- }).then((response)=>response.arrayBuffer().then((buffer)=>{
5079
- let responseHeaders = {};
5080
- return response.headers.forEach((value, key)=>{
5081
- responseHeaders[key] = value;
5082
- }), {
5083
- status: response.status,
5084
- headers: responseHeaders,
5085
- body: Buffer.from(buffer)
5086
- };
5087
- }));
5114
+ }), responseHeaders = {};
5115
+ for (let [key, value] of Object.entries(res.headers))Array.isArray(value) ? responseHeaders[key] = value.join(", ") : responseHeaders[key] = value;
5116
+ return {
5117
+ status: res.statusCode,
5118
+ headers: responseHeaders,
5119
+ body: Buffer.from(body)
5120
+ };
5121
+ };
5088
5122
  class HttpUriPlugin extends RspackBuiltinPlugin {
5089
5123
  options;
5090
5124
  name;
@@ -5656,7 +5690,20 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
5656
5690
  function normalizePath(path) {
5657
5691
  return path.replace(/\?.*$/, "").split(external_node_path_namespaceObject.sep).join("/");
5658
5692
  }
5659
- let ModuleInfoHeaderPlugin = base_create(binding_.BuiltinPluginName.ModuleInfoHeaderPlugin, (verbose)=>verbose, "compilation");
5693
+ let ModuleInfoHeaderPlugin = base_create(binding_.BuiltinPluginName.ModuleInfoHeaderPlugin, (verbose)=>verbose, "compilation"), CssChunkingPlugin = base_create(binding_.BuiltinPluginName.CssChunkingPlugin, function(options) {
5694
+ if (options.nextjs) return {
5695
+ strict: options.strict,
5696
+ exclude: /^pages\//
5697
+ };
5698
+ let { splitChunks } = this.options.optimization;
5699
+ if (splitChunks) {
5700
+ let cssMiniExtractIndex = splitChunks.defaultSizeTypes.indexOf("css/mini-extract");
5701
+ cssMiniExtractIndex && splitChunks.defaultSizeTypes.splice(cssMiniExtractIndex, 1);
5702
+ let cssIndex = splitChunks.defaultSizeTypes.indexOf("css");
5703
+ cssIndex && splitChunks.defaultSizeTypes.splice(cssIndex, 1);
5704
+ }
5705
+ return options;
5706
+ });
5660
5707
  function assertNotNill(value) {
5661
5708
  if (null == value) throw Error(`${value} should not be undefined or null`);
5662
5709
  }
@@ -6487,7 +6534,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6487
6534
  asyncWebAssembly: options.experiments.asyncWebAssembly,
6488
6535
  css: options.experiments.css,
6489
6536
  targetProperties,
6490
- mode: options.mode
6537
+ mode: options.mode,
6538
+ uniqueName: options.output.uniqueName
6491
6539
  }), applyOutputDefaults(options.output, {
6492
6540
  context: options.context,
6493
6541
  targetProperties,
@@ -6526,15 +6574,20 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6526
6574
  }, applyExperimentsDefaults = (experiments, { production, development })=>{
6527
6575
  F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !1), D(experiments.incremental, "providedExports", !1), D(experiments.incremental, "dependenciesDiagnostics", !1), D(experiments.incremental, "sideEffects", !1), D(experiments.incremental, "buildChunkGraph", !1), D(experiments.incremental, "moduleIds", !1), D(experiments.incremental, "chunkIds", !1), D(experiments.incremental, "modulesHashes", !1), D(experiments.incremental, "modulesCodegen", !1), D(experiments.incremental, "modulesRuntimeRequirements", !1), D(experiments.incremental, "chunksRuntimeRequirements", !1), D(experiments.incremental, "chunksHashes", !1), D(experiments.incremental, "chunksRender", !1), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !0), D(experiments, "parallelLoader", !1);
6528
6576
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
6529
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.3.10"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
6577
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.3.11"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
6530
6578
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyJavascriptParserOptionsDefaults = (parserOptions)=>{
6531
6579
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
6532
6580
  "..."
6533
6581
  ]), D(parserOptions, "importMeta", !0);
6534
6582
  }, applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
6535
6583
  D(generatorOptions, "JSONParse", !0);
6536
- }, applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties, mode })=>{
6537
- assertNotNill(module.parser), assertNotNill(module.generator), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, "maxSize", 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), applyJavascriptParserOptionsDefaults(module.parser.javascript), F(module.parser, JSON_MODULE_TYPE, ()=>({})), assertNotNill(module.parser[JSON_MODULE_TYPE]), D(module.parser[JSON_MODULE_TYPE], "exportsDepth", "development" === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, "json", ()=>({})), assertNotNill(module.generator.json), applyJsonGeneratorOptionsDefaults(module.generator.json), css && (F(module.parser, "css", ()=>({})), assertNotNill(module.parser.css), D(module.parser.css, "namedExports", !0), D(module.parser.css, "url", !0), F(module.parser, "css/auto", ()=>({})), assertNotNill(module.parser["css/auto"]), D(module.parser["css/auto"], "namedExports", !0), D(module.parser["css/auto"], "url", !0), F(module.parser, "css/module", ()=>({})), assertNotNill(module.parser["css/module"]), D(module.parser["css/module"], "namedExports", !0), D(module.parser["css/module"], "url", !0), F(module.generator, "css", ()=>({})), assertNotNill(module.generator.css), D(module.generator.css, "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator.css, "esModule", !0), F(module.generator, "css/auto", ()=>({})), assertNotNill(module.generator["css/auto"]), D(module.generator["css/auto"], "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator["css/auto"], "exportsConvention", "as-is"), D(module.generator["css/auto"], "localIdentName", "[uniqueName]-[id]-[local]"), D(module.generator["css/auto"], "esModule", !0), F(module.generator, "css/module", ()=>({})), assertNotNill(module.generator["css/module"]), D(module.generator["css/module"], "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator["css/module"], "exportsConvention", "as-is"), D(module.generator["css/module"], "localIdentName", "[uniqueName]-[id]-[local]"), D(module.generator["css/module"], "esModule", !0)), A(module, "defaultRules", ()=>{
6584
+ }, applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties, mode, uniqueName })=>{
6585
+ if (assertNotNill(module.parser), assertNotNill(module.generator), F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), F(module.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, "maxSize", 8096), F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), applyJavascriptParserOptionsDefaults(module.parser.javascript), F(module.parser, JSON_MODULE_TYPE, ()=>({})), assertNotNill(module.parser[JSON_MODULE_TYPE]), D(module.parser[JSON_MODULE_TYPE], "exportsDepth", "development" === mode ? 1 : Number.MAX_SAFE_INTEGER), F(module.generator, "json", ()=>({})), assertNotNill(module.generator.json), applyJsonGeneratorOptionsDefaults(module.generator.json), css) {
6586
+ F(module.parser, "css", ()=>({})), assertNotNill(module.parser.css), D(module.parser.css, "namedExports", !0), D(module.parser.css, "url", !0), F(module.parser, "css/auto", ()=>({})), assertNotNill(module.parser["css/auto"]), D(module.parser["css/auto"], "namedExports", !0), D(module.parser["css/auto"], "url", !0), F(module.parser, "css/module", ()=>({})), assertNotNill(module.parser["css/module"]), D(module.parser["css/module"], "namedExports", !0), D(module.parser["css/module"], "url", !0), F(module.generator, "css", ()=>({})), assertNotNill(module.generator.css), D(module.generator.css, "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator.css, "esModule", !0), F(module.generator, "css/auto", ()=>({})), assertNotNill(module.generator["css/auto"]), D(module.generator["css/auto"], "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator["css/auto"], "exportsConvention", "as-is");
6587
+ let localIdentName = uniqueName && uniqueName.length > 0 ? "[uniqueName]-[id]-[local]" : "[id]-[local]";
6588
+ D(module.generator["css/auto"], "localIdentName", localIdentName), D(module.generator["css/auto"], "esModule", !0), F(module.generator, "css/module", ()=>({})), assertNotNill(module.generator["css/module"]), D(module.generator["css/module"], "exportsOnly", !targetProperties || !targetProperties.document), D(module.generator["css/module"], "exportsConvention", "as-is"), D(module.generator["css/module"], "localIdentName", localIdentName), D(module.generator["css/module"], "esModule", !0);
6589
+ }
6590
+ A(module, "defaultRules", ()=>{
6538
6591
  let esm = {
6539
6592
  type: "javascript/esm",
6540
6593
  resolve: {
@@ -6736,7 +6789,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
6736
6789
  if (tp) {
6737
6790
  if (tp.fetchWasm) return "fetch";
6738
6791
  if (tp.nodeBuiltins) return "async-node";
6739
- if (null === tp.nodeBuiltins || null === tp.fetchWasm) return "universal";
6792
+ null === tp.nodeBuiltins || tp.fetchWasm;
6740
6793
  }
6741
6794
  return !1;
6742
6795
  }), F(output, "workerWasmLoading", ()=>output.wasmLoading), F(output, "globalObject", ()=>{
@@ -7429,7 +7482,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7429
7482
  },
7430
7483
  arm: "gnueabihf"
7431
7484
  }
7432
- }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.3.10", getAddonPlatformArchAbi = ()=>{
7485
+ }, BINDING_VERSION = __webpack_require__("@rspack/binding/package.json").version, CORE_VERSION = "1.3.11", getAddonPlatformArchAbi = ()=>{
7433
7486
  let { platform, arch } = process, binding = "";
7434
7487
  binding += platform;
7435
7488
  let abi = NodePlatformArchToAbi[platform][arch];
@@ -7997,7 +8050,26 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
7997
8050
  });
7998
8051
  }
7999
8052
  }
8000
- Object.defineProperty(binding_.Module.prototype, "identifier", {
8053
+ let $assets = Symbol("assets");
8054
+ Object.defineProperty(binding_.BuildInfo.prototype, "assets", {
8055
+ enumerable: !0,
8056
+ configurable: !0,
8057
+ get () {
8058
+ if (this._assets[$assets]) return this._assets[$assets];
8059
+ let assets = new Proxy(Object.create(null), {
8060
+ ownKeys: ()=>this._assets.keys(),
8061
+ getOwnPropertyDescriptor: ()=>({
8062
+ enumerable: !0,
8063
+ configurable: !0
8064
+ })
8065
+ });
8066
+ return Object.defineProperty(this._assets, $assets, {
8067
+ enumerable: !1,
8068
+ configurable: !0,
8069
+ value: assets
8070
+ }), assets;
8071
+ }
8072
+ }), Object.defineProperty(binding_.Module.prototype, "identifier", {
8001
8073
  enumerable: !0,
8002
8074
  configurable: !0,
8003
8075
  value () {
@@ -8152,7 +8224,132 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8152
8224
  await queried.promise(data, {});
8153
8225
  };
8154
8226
  })
8155
- }), COMPILATION_WEAK_MAP = new WeakMap();
8227
+ }), traceHookPlugin_PLUGIN_NAME = "TraceHookPlugin", makeInterceptorFor = (compilerName, tracer)=>(hookName)=>({
8228
+ register: (tapInfo)=>{
8229
+ let { name, type, fn: internalFn } = tapInfo, newFn = name === traceHookPlugin_PLUGIN_NAME ? internalFn : makeNewTraceTapFn(compilerName, hookName, tracer, {
8230
+ name,
8231
+ type,
8232
+ fn: internalFn
8233
+ });
8234
+ return {
8235
+ ...tapInfo,
8236
+ fn: newFn
8237
+ };
8238
+ }
8239
+ }), interceptAllHooksFor = (instance, tracer, logLabel)=>{
8240
+ if (Reflect.has(instance, "hooks")) for (let hookName of Object.keys(instance.hooks)){
8241
+ let hook = instance.hooks[hookName];
8242
+ hook && !hook._fakeHook && hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName));
8243
+ }
8244
+ }, makeNewTraceTapFn = (compilerName, hookName, tracer, { name: pluginName, type, fn })=>{
8245
+ let name = `${pluginName}:${hookName}`;
8246
+ switch(type){
8247
+ case "promise":
8248
+ return (...args)=>{
8249
+ let id2 = tracer.counter++;
8250
+ return tracer.startAsync({
8251
+ name,
8252
+ id: pluginName,
8253
+ args: {
8254
+ id2,
8255
+ compilerName,
8256
+ hookName,
8257
+ pluginName
8258
+ }
8259
+ }), fn(...args).then((r)=>(tracer.endAsync({
8260
+ name,
8261
+ id: pluginName,
8262
+ args: {
8263
+ id2,
8264
+ compilerName,
8265
+ hookName,
8266
+ pluginName
8267
+ }
8268
+ }), r));
8269
+ };
8270
+ case "async":
8271
+ return (...args)=>{
8272
+ let id2 = tracer.counter++;
8273
+ tracer.startAsync({
8274
+ name,
8275
+ id: pluginName,
8276
+ args: {
8277
+ id2,
8278
+ compilerName,
8279
+ hookName,
8280
+ pluginName
8281
+ }
8282
+ });
8283
+ let callback = args.pop();
8284
+ fn(...args, (...r)=>{
8285
+ tracer.endAsync({
8286
+ name,
8287
+ id: pluginName,
8288
+ args: {
8289
+ id2,
8290
+ compilerName,
8291
+ hookName,
8292
+ pluginName
8293
+ }
8294
+ }), callback(...r);
8295
+ });
8296
+ };
8297
+ case "sync":
8298
+ return (...args)=>{
8299
+ let r, id2 = tracer.counter++;
8300
+ if (name === traceHookPlugin_PLUGIN_NAME) return fn(...args);
8301
+ tracer.startAsync({
8302
+ name,
8303
+ id: pluginName,
8304
+ args: {
8305
+ id2,
8306
+ compilerName,
8307
+ hookName,
8308
+ pluginName
8309
+ }
8310
+ });
8311
+ try {
8312
+ r = fn(...args);
8313
+ } catch (err) {
8314
+ throw tracer.endAsync({
8315
+ name,
8316
+ id: pluginName,
8317
+ args: {
8318
+ id2: compilerName,
8319
+ hookName,
8320
+ pluginName
8321
+ }
8322
+ }), err;
8323
+ }
8324
+ return tracer.endAsync({
8325
+ name,
8326
+ id: pluginName,
8327
+ args: {
8328
+ id2,
8329
+ compilerName,
8330
+ hookName,
8331
+ pluginName
8332
+ }
8333
+ }), r;
8334
+ };
8335
+ default:
8336
+ return fn;
8337
+ }
8338
+ }, compilerId = 0;
8339
+ class TraceHookPlugin {
8340
+ name = traceHookPlugin_PLUGIN_NAME;
8341
+ apply(compiler) {
8342
+ let compilerName = compiler.name || (compilerId++).toString();
8343
+ for (let hookName of Object.keys(compiler.hooks)){
8344
+ let hook = compiler.hooks[hookName];
8345
+ hook && hook.intercept(makeInterceptorFor(compilerName, JavaScriptTracer)(hookName));
8346
+ }
8347
+ compiler.hooks.compilation.tap(traceHookPlugin_PLUGIN_NAME, (compilation, { normalModuleFactory, contextModuleFactory })=>{
8348
+ interceptAllHooksFor(compilation, JavaScriptTracer, "Compilation"), interceptAllHooksFor(normalModuleFactory, JavaScriptTracer, "Normal Module Factory"), interceptAllHooksFor(contextModuleFactory, JavaScriptTracer, "Context Module Factory");
8349
+ });
8350
+ }
8351
+ }
8352
+ let COMPILATION_WEAK_MAP = new WeakMap();
8156
8353
  class Compiler {
8157
8354
  #instance;
8158
8355
  #initial;
@@ -8277,7 +8474,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8277
8474
  "entry"
8278
8475
  ]),
8279
8476
  additionalPass: new lite_tapable_namespaceObject.AsyncSeriesHook([])
8280
- }, this.webpack = src_rspack, this.rspack = src_rspack, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache_Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault()), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this);
8477
+ }, this.webpack = src_rspack, this.rspack = src_rspack, this.root = this, this.outputPath = "", this.inputFileSystem = null, this.intermediateFileSystem = null, this.outputFileSystem = null, this.watchFileSystem = null, this.records = {}, this.options = options, this.context = context, this.cache = new Cache_Cache(), this.compilerPath = "", this.running = !1, this.idle = !1, this.watchMode = !1, this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault()), new JsLoaderRspackPlugin(this).apply(this), new ExecuteModulePlugin().apply(this), new TraceHookPlugin().apply(this);
8281
8478
  }
8282
8479
  get recordsInputPath() {
8283
8480
  return unsupported("Compiler.recordsInputPath");
@@ -8608,7 +8805,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8608
8805
  obj.children = this.stats.map((stat, idx)=>{
8609
8806
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
8610
8807
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
8611
- }), childOptions.version && (obj.rspackVersion = "1.3.10", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8808
+ }), childOptions.version && (obj.rspackVersion = "1.3.11", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
8612
8809
  let mapError = (j, obj)=>({
8613
8810
  ...obj,
8614
8811
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -9498,7 +9695,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9498
9695
  object.hash = context.getStatsCompilation(compilation).hash;
9499
9696
  },
9500
9697
  version: (object)=>{
9501
- object.version = "5.75.0", object.rspackVersion = "1.3.10";
9698
+ object.version = "5.75.0", object.rspackVersion = "1.3.11";
9502
9699
  },
9503
9700
  env: (object, _compilation, _context, { _env })=>{
9504
9701
  object.env = _env;
@@ -9510,6 +9707,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
9510
9707
  object.builtAt = compilation.endTime;
9511
9708
  },
9512
9709
  publicPath: (object, compilation)=>{
9710
+ if ("function" == typeof compilation.outputOptions.publicPath) throw new DeadlockRiskError("publicPath as function can't be used with stats.publicPath=true, which may cause deadlock risk, consider setting stats.publicPath=false in rspack config");
9513
9711
  object.publicPath = compilation.getPath(compilation.outputOptions.publicPath || "");
9514
9712
  },
9515
9713
  outputPath: (object, compilation)=>{
@@ -11944,7 +12142,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
11944
12142
  }), entryStatic = zod_index_js_namespaceObject.z.record(entryItem.or(entryDescription)).or(entryItem), entryDynamic = zod_index_js_namespaceObject.z.function().returns(entryStatic.or(zod_index_js_namespaceObject.z.promise(entryStatic))), zod_entry = entryStatic.or(entryDynamic), zod_path = zod_index_js_namespaceObject.z.string(), pathinfo = zod_index_js_namespaceObject.z.boolean().or(zod_index_js_namespaceObject.z.literal("verbose")), webassemblyModuleFilename = zod_index_js_namespaceObject.z.string(), zod_crossOriginLoading = zod_index_js_namespaceObject.z.literal(!1).or(zod_index_js_namespaceObject.z.enum([
11945
12143
  "anonymous",
11946
12144
  "use-credentials"
11947
- ])), hotUpdateGlobal = zod_index_js_namespaceObject.z.string(), uniqueName = zod_index_js_namespaceObject.z.string(), chunkLoadingGlobal = zod_index_js_namespaceObject.z.string(), zod_enabledLibraryTypes = zod_index_js_namespaceObject.z.array(libraryType), clean = zod_index_js_namespaceObject.z.union([
12145
+ ])), hotUpdateGlobal = zod_index_js_namespaceObject.z.string(), zod_uniqueName = zod_index_js_namespaceObject.z.string(), chunkLoadingGlobal = zod_index_js_namespaceObject.z.string(), zod_enabledLibraryTypes = zod_index_js_namespaceObject.z.array(libraryType), clean = zod_index_js_namespaceObject.z.union([
11948
12146
  zod_index_js_namespaceObject.z.boolean(),
11949
12147
  zod_index_js_namespaceObject.z.strictObject({
11950
12148
  keep: zod_index_js_namespaceObject.z.instanceof(RegExp).or(zod_index_js_namespaceObject.z.string()).or(zod_index_js_namespaceObject.z.function().args(zod_index_js_namespaceObject.z.string()).returns(zod_index_js_namespaceObject.z.boolean())).optional()
@@ -11993,7 +12191,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
11993
12191
  hotUpdateChunkFilename: filenameTemplate.optional(),
11994
12192
  hotUpdateGlobal: hotUpdateGlobal.optional(),
11995
12193
  assetModuleFilename: zod_filename.optional(),
11996
- uniqueName: uniqueName.optional(),
12194
+ uniqueName: zod_uniqueName.optional(),
11997
12195
  chunkLoadingGlobal: chunkLoadingGlobal.optional(),
11998
12196
  enabledLibraryTypes: zod_enabledLibraryTypes.optional(),
11999
12197
  library: zod_library.optional(),
@@ -13161,7 +13359,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13161
13359
  let _options = JSON.stringify(options || {});
13162
13360
  return binding_default().transform(source, _options);
13163
13361
  }
13164
- let exports_rspackVersion = "1.3.10", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
13362
+ let exports_rspackVersion = "1.3.11", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
13165
13363
  getNormalizedRspackOptions: getNormalizedRspackOptions,
13166
13364
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
13167
13365
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
@@ -13268,7 +13466,8 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
13268
13466
  swc: {
13269
13467
  minify: minify,
13270
13468
  transform: transform
13271
- }
13469
+ },
13470
+ CssChunkingPlugin: CssChunkingPlugin
13272
13471
  };
13273
13472
  function createCompiler(userOptions) {
13274
13473
  let options = getNormalizedRspackOptions(userOptions);
@@ -3,9 +3,9 @@ export interface ChromeEvent {
3
3
  ph?: string;
4
4
  cat?: string;
5
5
  ts?: number;
6
- pid?: number;
7
- tid?: number;
8
- id?: number;
6
+ pid?: number | string;
7
+ tid?: number | string;
8
+ id?: number | string;
9
9
  args?: {
10
10
  [key: string]: any;
11
11
  };
@@ -20,6 +20,7 @@ export declare class JavaScriptTracer {
20
20
  static layer: string;
21
21
  static output: string;
22
22
  static session: import("node:inspector").Session;
23
+ static counter: number;
23
24
  static initJavaScriptTrace(layer: string, output: string): Promise<void>;
24
25
  static initCpuProfiler(): void;
25
26
  static cleanupJavaScriptTrace(): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { Compiler } from "../exports";
2
+ export declare class TraceHookPlugin {
3
+ name: string;
4
+ apply(compiler: Compiler): void;
5
+ }
package/dist/worker.js CHANGED
@@ -853,7 +853,7 @@ for(var __webpack_i__ in (()=>{
853
853
  await loadLoaderAsync(currentLoaderObject);
854
854
  let fn = currentLoaderObject.normal;
855
855
  currentLoaderObject.normalExecuted = !0, fn && (args1 = args, !(raw = !!currentLoaderObject.raw) && args1[0] instanceof Uint8Array ? args1[0] = function(buf) {
856
- let str = decoder.decode(buf);
856
+ let str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf);
857
857
  return 0xfeff === str.charCodeAt(0) ? str.slice(1) : str;
858
858
  }(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) || []);
859
859
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@swc/core": "1.11.24",
41
41
  "@swc/types": "0.1.21",
42
- "@rslib/core": "0.6.8",
42
+ "@rslib/core": "0.7.0",
43
43
  "@types/graceful-fs": "4.1.9",
44
44
  "@types/watchpack": "^2.4.4",
45
45
  "@types/webpack-sources": "3.2.3",
@@ -58,8 +58,8 @@
58
58
  "dependencies": {
59
59
  "@module-federation/runtime-tools": "0.13.1",
60
60
  "@rspack/lite-tapable": "1.0.1",
61
- "caniuse-lite": "^1.0.30001717",
62
- "@rspack/binding": "1.3.10"
61
+ "caniuse-lite": "^1.0.30001718",
62
+ "@rspack/binding": "1.3.11"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@swc/helpers": ">=0.5.1"