@rspack/core 1.1.4 → 1.1.5

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.
@@ -375,6 +375,8 @@ export declare class Compilation {
375
375
  * @internal
376
376
  */
377
377
  __internal_getInner(): binding.JsCompilation;
378
+ get __internal__shutdown(): boolean;
379
+ set __internal__shutdown(shutdown: boolean);
378
380
  seal(): void;
379
381
  unseal(): void;
380
382
  static PROCESS_ASSETS_STAGE_ADDITIONAL: number;
package/dist/Module.d.ts CHANGED
@@ -74,6 +74,7 @@ export declare class Module {
74
74
  readonly buildMeta: Record<string, any>;
75
75
  readonly modules: Module[] | undefined;
76
76
  readonly blocks: DependenciesBlock[];
77
+ readonly dependencies: Dependency[];
77
78
  readonly useSourceMap: boolean;
78
79
  static __from_binding(binding: JsModule, compilation?: Compilation): Module;
79
80
  static __to_binding(module: Module): JsModule;
package/dist/Stats.d.ts CHANGED
@@ -4,8 +4,8 @@ import type { StatsCompilation } from "./stats/statsFactoryUtils";
4
4
  export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule } from "./stats/statsFactoryUtils";
5
5
  export declare class Stats {
6
6
  #private;
7
- compilation: Compilation;
8
7
  constructor(compilation: Compilation);
8
+ get compilation(): Compilation;
9
9
  get hash(): Readonly<string | null>;
10
10
  get startTime(): number | undefined;
11
11
  get endTime(): number | undefined;
@@ -47,6 +47,8 @@ export type HtmlRspackPluginOptions = {
47
47
  chunks?: string[];
48
48
  /** Allows you to skip some chunks. */
49
49
  excludeChunks?: string[];
50
+ /** Allows to control how chunks should be sorted before they are included to the HTML. */
51
+ chunksSortMode?: "auto" | "manual";
50
52
  /** The sri hash algorithm, disabled by default. */
51
53
  sri?: "sha256" | "sha384" | "sha512";
52
54
  /**
@@ -66,7 +66,6 @@ export interface OutputNormalized {
66
66
  environment?: Environment;
67
67
  charset?: boolean;
68
68
  chunkLoadTimeout?: number;
69
- cssHeadDataCompression?: boolean;
70
69
  compareBeforeEmit?: boolean;
71
70
  }
72
71
  export interface ModuleOptionsNormalized {
@@ -124,5 +123,6 @@ export interface RspackOptionsNormalized {
124
123
  ignoreWarnings?: IgnoreWarningsNormalized;
125
124
  performance?: Performance;
126
125
  profile?: Profile;
126
+ amd?: string;
127
127
  bail?: Bail;
128
128
  }
@@ -275,6 +275,7 @@ export type Output = {
275
275
  /** This option determines the name of CSS output files on disk. */
276
276
  cssFilename?: CssFilename;
277
277
  /**
278
+ * @deprecated this config is unused, and will be removed in the future.
278
279
  * Rspack adds some metadata in CSS to parse CSS modules, and this configuration determines whether to compress these metadata.
279
280
  *
280
281
  * The value is `true` in production mode.
@@ -1951,6 +1952,10 @@ export type IgnoreWarnings = (RegExp | ((error: Error, compilation: Compilation)
1951
1952
  * Capture a "profile" of the application, including statistics and hints, which can then be dissected using the Analyze tool.
1952
1953
  * */
1953
1954
  export type Profile = boolean;
1955
+ /**
1956
+ * Set the value of `require.amd` and `define.amd`. Or disable AMD support.
1957
+ */
1958
+ export type Amd = false | Record<string, any>;
1954
1959
  /**
1955
1960
  * Fail out on the first error instead of tolerating it.
1956
1961
  * @default false
@@ -2090,6 +2095,11 @@ export type RspackOptions = {
2090
2095
  * Whether to capture a profile of the application.
2091
2096
  */
2092
2097
  profile?: Profile;
2098
+ /**
2099
+ * Set the value of `require.amd` or `define.amd`.
2100
+ * Setting `amd` to false will disable rspack's AMD support.
2101
+ */
2102
+ amd?: Amd;
2093
2103
  /**
2094
2104
  * Whether to fail on the first error.
2095
2105
  */
@@ -656,6 +656,7 @@ export declare const rspackOptions: z.ZodObject<{
656
656
  umdNamedDefine?: boolean | undefined;
657
657
  } | undefined;
658
658
  wasmLoading?: string | false | undefined;
659
+ cssHeadDataCompression?: boolean | undefined;
659
660
  auxiliaryComment?: string | {
660
661
  root?: string | undefined;
661
662
  commonjs?: string | undefined;
@@ -701,7 +702,6 @@ export declare const rspackOptions: z.ZodObject<{
701
702
  devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
702
703
  charset?: boolean | undefined;
703
704
  chunkLoadTimeout?: number | undefined;
704
- cssHeadDataCompression?: boolean | undefined;
705
705
  compareBeforeEmit?: boolean | undefined;
706
706
  libraryExport?: string | string[] | undefined;
707
707
  libraryTarget?: string | undefined;
@@ -752,6 +752,7 @@ export declare const rspackOptions: z.ZodObject<{
752
752
  umdNamedDefine?: boolean | undefined;
753
753
  } | undefined;
754
754
  wasmLoading?: string | false | undefined;
755
+ cssHeadDataCompression?: boolean | undefined;
755
756
  auxiliaryComment?: string | {
756
757
  root?: string | undefined;
757
758
  commonjs?: string | undefined;
@@ -797,7 +798,6 @@ export declare const rspackOptions: z.ZodObject<{
797
798
  devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
798
799
  charset?: boolean | undefined;
799
800
  chunkLoadTimeout?: number | undefined;
800
- cssHeadDataCompression?: boolean | undefined;
801
801
  compareBeforeEmit?: boolean | undefined;
802
802
  libraryExport?: string | string[] | undefined;
803
803
  libraryTarget?: string | undefined;
@@ -2944,6 +2944,7 @@ export declare const rspackOptions: z.ZodObject<{
2944
2944
  noParse?: string | RegExp | ((args_0: string, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: string, ...args: unknown[]) => boolean))[] | undefined;
2945
2945
  }>>;
2946
2946
  profile: z.ZodOptional<z.ZodBoolean>;
2947
+ amd: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<false>, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
2947
2948
  bail: z.ZodOptional<z.ZodBoolean>;
2948
2949
  performance: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
2949
2950
  assetFilter: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodBoolean>>;
@@ -3210,6 +3211,7 @@ export declare const rspackOptions: z.ZodObject<{
3210
3211
  __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
3211
3212
  __filename?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
3212
3213
  } | undefined;
3214
+ amd?: false | Record<string, any> | undefined;
3213
3215
  profile?: boolean | undefined;
3214
3216
  cache?: boolean | undefined;
3215
3217
  devtool?: false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | undefined;
@@ -3324,6 +3326,7 @@ export declare const rspackOptions: z.ZodObject<{
3324
3326
  umdNamedDefine?: boolean | undefined;
3325
3327
  } | undefined;
3326
3328
  wasmLoading?: string | false | undefined;
3329
+ cssHeadDataCompression?: boolean | undefined;
3327
3330
  auxiliaryComment?: string | {
3328
3331
  root?: string | undefined;
3329
3332
  commonjs?: string | undefined;
@@ -3369,7 +3372,6 @@ export declare const rspackOptions: z.ZodObject<{
3369
3372
  devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
3370
3373
  charset?: boolean | undefined;
3371
3374
  chunkLoadTimeout?: number | undefined;
3372
- cssHeadDataCompression?: boolean | undefined;
3373
3375
  compareBeforeEmit?: boolean | undefined;
3374
3376
  libraryExport?: string | string[] | undefined;
3375
3377
  libraryTarget?: string | undefined;
@@ -3832,6 +3834,7 @@ export declare const rspackOptions: z.ZodObject<{
3832
3834
  __dirname?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
3833
3835
  __filename?: boolean | "warn-mock" | "mock" | "eval-only" | "node-module" | undefined;
3834
3836
  } | undefined;
3837
+ amd?: false | Record<string, any> | undefined;
3835
3838
  profile?: boolean | undefined;
3836
3839
  cache?: boolean | undefined;
3837
3840
  devtool?: false | "eval" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | undefined;
@@ -3946,6 +3949,7 @@ export declare const rspackOptions: z.ZodObject<{
3946
3949
  umdNamedDefine?: boolean | undefined;
3947
3950
  } | undefined;
3948
3951
  wasmLoading?: string | false | undefined;
3952
+ cssHeadDataCompression?: boolean | undefined;
3949
3953
  auxiliaryComment?: string | {
3950
3954
  root?: string | undefined;
3951
3955
  commonjs?: string | undefined;
@@ -3991,7 +3995,6 @@ export declare const rspackOptions: z.ZodObject<{
3991
3995
  devtoolFallbackModuleFilenameTemplate?: string | ((args_0: any) => any) | undefined;
3992
3996
  charset?: boolean | undefined;
3993
3997
  chunkLoadTimeout?: number | undefined;
3994
- cssHeadDataCompression?: boolean | undefined;
3995
3998
  compareBeforeEmit?: boolean | undefined;
3996
3999
  libraryExport?: string | string[] | undefined;
3997
4000
  libraryTarget?: string | undefined;
package/dist/index.js CHANGED
@@ -742,7 +742,7 @@ __export(src_exports, {
742
742
  rspackVersion: () => rspackVersion,
743
743
  sharing: () => sharing,
744
744
  sources: () => sources,
745
- util: () => util6,
745
+ util: () => util7,
746
746
  version: () => version,
747
747
  wasm: () => wasm,
748
748
  web: () => web,
@@ -804,7 +804,7 @@ __export(exports_exports, {
804
804
  rspackVersion: () => rspackVersion,
805
805
  sharing: () => sharing,
806
806
  sources: () => sources,
807
- util: () => util6,
807
+ util: () => util7,
808
808
  version: () => version,
809
809
  wasm: () => wasm,
810
810
  web: () => web,
@@ -1716,10 +1716,11 @@ RuntimeModule.STAGE_TRIGGER = 20 /* TRIGGER */;
1716
1716
  // src/Stats.ts
1717
1717
  var Stats = class {
1718
1718
  #inner;
1719
+ #compilation;
1719
1720
  #innerMap;
1720
1721
  constructor(compilation) {
1721
1722
  this.#inner = compilation.__internal_getInner().getStats();
1722
- this.compilation = compilation;
1723
+ this.#compilation = compilation;
1723
1724
  this.#innerMap = new WeakMap([[this.compilation, this.#inner]]);
1724
1725
  }
1725
1726
  // use correct JsStats for child compilation
@@ -1731,6 +1732,14 @@ var Stats = class {
1731
1732
  this.#innerMap.set(compilation, inner);
1732
1733
  return inner;
1733
1734
  }
1735
+ get compilation() {
1736
+ if (this.#compilation.__internal__shutdown) {
1737
+ throw new Error(
1738
+ "Unable to access `Stats` after the compiler was shutdown"
1739
+ );
1740
+ }
1741
+ return this.#compilation;
1742
+ }
1734
1743
  get hash() {
1735
1744
  return this.compilation.hash;
1736
1745
  }
@@ -2662,24 +2671,20 @@ var JsAssetInfo = class {
2662
2671
 
2663
2672
  // src/util/MergeCaller.ts
2664
2673
  var MergeCaller = class {
2665
- constructor(fn2, debounceTime) {
2666
- this.timer = null;
2674
+ constructor(fn2) {
2667
2675
  this.callArgs = [];
2668
2676
  this.finalCall = () => {
2669
- this.timer = null;
2670
2677
  const args = this.callArgs;
2671
2678
  this.callArgs = [];
2672
2679
  this.callFn(args);
2673
2680
  };
2674
- this.debounceTime = debounceTime;
2675
2681
  this.callFn = fn2;
2676
2682
  }
2677
2683
  push(...data) {
2678
- if (this.timer) {
2679
- clearTimeout(this.timer);
2684
+ if (this.callArgs.length === 0) {
2685
+ queueMicrotask(this.finalCall);
2680
2686
  }
2681
2687
  this.callArgs.push(...data);
2682
- this.timer = setTimeout(this.finalCall, this.debounceTime);
2683
2688
  }
2684
2689
  };
2685
2690
 
@@ -2712,7 +2717,7 @@ function createReadonlyMap(obj) {
2712
2717
 
2713
2718
  // src/util/fake.ts
2714
2719
  function createFakeCompilationDependencies(getDeps, addDeps) {
2715
- const addDepsCaller = new MergeCaller(addDeps, 10);
2720
+ const addDepsCaller = new MergeCaller(addDeps);
2716
2721
  return {
2717
2722
  *[Symbol.iterator]() {
2718
2723
  const deps = getDeps();
@@ -2787,11 +2792,12 @@ function memoizeValue(fn2) {
2787
2792
  }
2788
2793
 
2789
2794
  // src/Compilation.ts
2790
- var _inner, _customModules, _Compilation_instances, createCachedAssets_fn, _rebuildModuleCaller;
2795
+ var _inner, _shutdown, _customModules, _Compilation_instances, createCachedAssets_fn, _rebuildModuleCaller;
2791
2796
  var _Compilation = class _Compilation {
2792
2797
  constructor(compiler, inner) {
2793
2798
  __privateAdd(this, _Compilation_instances);
2794
2799
  __privateAdd(this, _inner);
2800
+ __privateAdd(this, _shutdown);
2795
2801
  this.fileSystemInfo = {
2796
2802
  createSnapshot() {
2797
2803
  return null;
@@ -2833,10 +2839,10 @@ var _Compilation = class _Compilation {
2833
2839
  }
2834
2840
  }
2835
2841
  );
2836
- },
2837
- 10
2842
+ }
2838
2843
  ))(this));
2839
2844
  __privateSet(this, _inner, inner);
2845
+ __privateSet(this, _shutdown, false);
2840
2846
  __privateSet(this, _customModules, {});
2841
2847
  const processAssetsHook = new liteTapable.AsyncSeriesHook([
2842
2848
  "assets"
@@ -3574,12 +3580,19 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
3574
3580
  __internal_getInner() {
3575
3581
  return __privateGet(this, _inner);
3576
3582
  }
3583
+ get __internal__shutdown() {
3584
+ return __privateGet(this, _shutdown);
3585
+ }
3586
+ set __internal__shutdown(shutdown) {
3587
+ __privateSet(this, _shutdown, shutdown);
3588
+ }
3577
3589
  seal() {
3578
3590
  }
3579
3591
  unseal() {
3580
3592
  }
3581
3593
  };
3582
3594
  _inner = new WeakMap();
3595
+ _shutdown = new WeakMap();
3583
3596
  _customModules = new WeakMap();
3584
3597
  _Compilation_instances = new WeakSet();
3585
3598
  createCachedAssets_fn = function() {
@@ -6770,6 +6783,7 @@ var getRawOptions = (options, compiler) => {
6770
6783
  node: getRawNode(options.node),
6771
6784
  // SAFETY: applied default value in `applyRspackOptionsDefaults`.
6772
6785
  profile: options.profile,
6786
+ amd: options.amd,
6773
6787
  // SAFETY: applied default value in `applyRspackOptionsDefaults`.
6774
6788
  bail: options.bail,
6775
6789
  __references: {}
@@ -6851,7 +6865,6 @@ function getRawOutput(output2) {
6851
6865
  crossOriginLoading: getRawCrossOriginLoading(output2.crossOriginLoading),
6852
6866
  cssFilename: output2.cssFilename,
6853
6867
  cssChunkFilename: output2.cssChunkFilename,
6854
- cssHeadDataCompression: output2.cssHeadDataCompression,
6855
6868
  hotUpdateChunkFilename: output2.hotUpdateChunkFilename,
6856
6869
  hotUpdateMainFilename: output2.hotUpdateMainFilename,
6857
6870
  hotUpdateGlobal: output2.hotUpdateGlobal,
@@ -8903,7 +8916,6 @@ while determining default 'output.uniqueName' from 'name' in ${pkgPath}`;
8903
8916
  const uniqueNameId = Template.toIdentifier(output2.uniqueName);
8904
8917
  F(output2, "hotUpdateGlobal", () => `webpackHotUpdate${uniqueNameId}`);
8905
8918
  F(output2, "chunkLoadingGlobal", () => `webpackChunk${uniqueNameId}`);
8906
- D(output2, "cssHeadDataCompression", !development);
8907
8919
  D(output2, "assetModuleFilename", "[hash][ext][query]");
8908
8920
  D(output2, "webassemblyModuleFilename", "[hash].module.wasm");
8909
8921
  D(output2, "compareBeforeEmit", true);
@@ -9375,6 +9387,7 @@ var A = (obj, prop, factory) => {
9375
9387
  };
9376
9388
 
9377
9389
  // src/config/normalization.ts
9390
+ var import_node_util4 = __toESM(require("util"));
9378
9391
  var getNormalizedRspackOptions = (config2) => {
9379
9392
  return {
9380
9393
  ignoreWarnings: config2.ignoreWarnings !== void 0 ? config2.ignoreWarnings.map((ignore) => {
@@ -9391,6 +9404,13 @@ var getNormalizedRspackOptions = (config2) => {
9391
9404
  mode: config2.mode,
9392
9405
  entry: config2.entry === void 0 ? { main: {} } : typeof config2.entry === "function" ? /* @__PURE__ */ ((fn2) => () => Promise.resolve().then(fn2).then(getNormalizedEntryStatic))(config2.entry) : getNormalizedEntryStatic(config2.entry),
9393
9406
  output: nestedConfig(config2.output, (output2) => {
9407
+ if ("cssHeadDataCompression" in output2) {
9408
+ import_node_util4.default.deprecate(
9409
+ () => {
9410
+ },
9411
+ "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future"
9412
+ )();
9413
+ }
9394
9414
  const { library: library3 } = output2;
9395
9415
  const libraryAsName = library3;
9396
9416
  const libraryBase = typeof library3 === "object" && library3 && !Array.isArray(library3) && "type" in library3 ? library3 : libraryAsName || output2.libraryTarget ? {
@@ -9406,7 +9426,6 @@ var getNormalizedRspackOptions = (config2) => {
9406
9426
  chunkLoading: output2.chunkLoading,
9407
9427
  chunkFilename: output2.chunkFilename,
9408
9428
  crossOriginLoading: output2.crossOriginLoading,
9409
- cssHeadDataCompression: output2.cssHeadDataCompression,
9410
9429
  cssFilename: output2.cssFilename,
9411
9430
  cssChunkFilename: output2.cssChunkFilename,
9412
9431
  hotUpdateMainFilename: output2.hotUpdateMainFilename,
@@ -9571,6 +9590,7 @@ var getNormalizedRspackOptions = (config2) => {
9571
9590
  watchOptions: cloneObject(config2.watchOptions),
9572
9591
  devServer: config2.devServer,
9573
9592
  profile: config2.profile,
9593
+ amd: config2.amd ? JSON.stringify(config2.amd) : void 0,
9574
9594
  bail: config2.bail
9575
9595
  };
9576
9596
  };
@@ -10766,6 +10786,7 @@ var ignoreWarnings = import_zod2.z.instanceof(RegExp).or(
10766
10786
  import_zod2.z.function().args(import_zod2.z.instanceof(Error), import_zod2.z.custom()).returns(import_zod2.z.boolean())
10767
10787
  ).array();
10768
10788
  var profile = import_zod2.z.boolean();
10789
+ var amd = import_zod2.z.literal(false).or(import_zod2.z.record(import_zod2.z.any()));
10769
10790
  var bail = import_zod2.z.boolean();
10770
10791
  var performance = import_zod2.z.strictObject({
10771
10792
  assetFilter: import_zod2.z.function().args(import_zod2.z.string()).returns(import_zod2.z.boolean()).optional(),
@@ -10802,6 +10823,7 @@ var rspackOptions = import_zod2.z.strictObject({
10802
10823
  devServer: devServer.optional(),
10803
10824
  module: moduleOptions.optional(),
10804
10825
  profile: profile.optional(),
10826
+ amd: amd.optional(),
10805
10827
  bail: bail.optional(),
10806
10828
  performance: performance.optional()
10807
10829
  });
@@ -11367,6 +11389,7 @@ var htmlRspackPluginOptions = import_zod3.z.strictObject({
11367
11389
  scriptLoading: import_zod3.z.enum(["blocking", "defer", "module", "systemjs-module"]).optional(),
11368
11390
  chunks: import_zod3.z.string().array().optional(),
11369
11391
  excludeChunks: import_zod3.z.string().array().optional(),
11392
+ chunksSortMode: import_zod3.z.enum(["auto", "manual"]).optional(),
11370
11393
  sri: import_zod3.z.enum(["sha256", "sha384", "sha512"]).optional(),
11371
11394
  minify: import_zod3.z.boolean().optional(),
11372
11395
  title: import_zod3.z.string().optional(),
@@ -11397,6 +11420,7 @@ var HtmlRspackPluginImpl = create2(
11397
11420
  const configInject = c.inject ?? true;
11398
11421
  const inject = configInject === true ? scriptLoading === "blocking" ? "body" : "head" : configInject === false ? "false" : configInject;
11399
11422
  const base = typeof c.base === "string" ? { href: c.base } : c.base;
11423
+ const chunksSortMode = c.chunksSortMode ?? "auto";
11400
11424
  let compilation = null;
11401
11425
  this.hooks.compilation.tap("HtmlRspackPlugin", (compilationInstance) => {
11402
11426
  compilation = compilationInstance;
@@ -11525,6 +11549,7 @@ var HtmlRspackPluginImpl = create2(
11525
11549
  publicPath: c.publicPath,
11526
11550
  chunks: c.chunks,
11527
11551
  excludeChunks: c.excludeChunks,
11552
+ chunksSortMode,
11528
11553
  sri: c.sri,
11529
11554
  minify: c.minify,
11530
11555
  meta,
@@ -12043,7 +12068,8 @@ var ProvidePlugin = create2(
12043
12068
  return [key, value];
12044
12069
  });
12045
12070
  return Object.fromEntries(entries);
12046
- }
12071
+ },
12072
+ "compilation"
12047
12073
  );
12048
12074
 
12049
12075
  // src/builtin-plugin/RealContentHashPlugin.ts
@@ -12500,7 +12526,7 @@ var ContextModuleFactory = class {
12500
12526
  };
12501
12527
 
12502
12528
  // src/FileSystem.ts
12503
- var import_node_util4 = __toESM(require("util"));
12529
+ var import_node_util5 = __toESM(require("util"));
12504
12530
 
12505
12531
  // src/util/fs.ts
12506
12532
  var import_node_assert6 = __toESM(require("assert"));
@@ -12636,21 +12662,21 @@ var ThreadsafeWritableNodeFS = class _ThreadsafeWritableNodeFS {
12636
12662
  Object.assign(this, NOOP_FILESYSTEM);
12637
12663
  return;
12638
12664
  }
12639
- this.writeFile = memoizeFn(() => import_node_util4.default.promisify(fs5.writeFile.bind(fs5)));
12640
- this.removeFile = memoizeFn(() => import_node_util4.default.promisify(fs5.unlink.bind(fs5)));
12641
- this.mkdir = memoizeFn(() => import_node_util4.default.promisify(fs5.mkdir.bind(fs5)));
12642
- this.mkdirp = memoizeFn(() => import_node_util4.default.promisify(mkdirp.bind(null, fs5)));
12643
- this.removeDirAll = memoizeFn(() => import_node_util4.default.promisify(rmrf.bind(null, fs5)));
12665
+ this.writeFile = memoizeFn(() => import_node_util5.default.promisify(fs5.writeFile.bind(fs5)));
12666
+ this.removeFile = memoizeFn(() => import_node_util5.default.promisify(fs5.unlink.bind(fs5)));
12667
+ this.mkdir = memoizeFn(() => import_node_util5.default.promisify(fs5.mkdir.bind(fs5)));
12668
+ this.mkdirp = memoizeFn(() => import_node_util5.default.promisify(mkdirp.bind(null, fs5)));
12669
+ this.removeDirAll = memoizeFn(() => import_node_util5.default.promisify(rmrf.bind(null, fs5)));
12644
12670
  this.readDir = memoizeFn(() => {
12645
- const readDirFn = import_node_util4.default.promisify(fs5.readdir.bind(fs5));
12671
+ const readDirFn = import_node_util5.default.promisify(fs5.readdir.bind(fs5));
12646
12672
  return async (filePath) => {
12647
12673
  const res = await readDirFn(filePath);
12648
12674
  return res;
12649
12675
  };
12650
12676
  });
12651
- this.readFile = memoizeFn(() => import_node_util4.default.promisify(fs5.readFile.bind(fs5)));
12677
+ this.readFile = memoizeFn(() => import_node_util5.default.promisify(fs5.readFile.bind(fs5)));
12652
12678
  this.stat = memoizeFn(() => {
12653
- const statFn = import_node_util4.default.promisify(fs5.stat.bind(fs5));
12679
+ const statFn = import_node_util5.default.promisify(fs5.stat.bind(fs5));
12654
12680
  return async (filePath) => {
12655
12681
  const res = await statFn(filePath);
12656
12682
  return res && {
@@ -12665,7 +12691,7 @@ var ThreadsafeWritableNodeFS = class _ThreadsafeWritableNodeFS {
12665
12691
  };
12666
12692
  });
12667
12693
  this.lstat = memoizeFn(() => {
12668
- const statFn = import_node_util4.default.promisify((fs5.lstat || fs5.stat).bind(fs5));
12694
+ const statFn = import_node_util5.default.promisify((fs5.lstat || fs5.stat).bind(fs5));
12669
12695
  return async (filePath) => {
12670
12696
  const res = await statFn(filePath);
12671
12697
  return res && _ThreadsafeWritableNodeFS.__to_binding_stat(res);
@@ -13211,7 +13237,10 @@ var Compiler = class _Compiler {
13211
13237
  new ExecuteModulePlugin().apply(this);
13212
13238
  this.hooks.shutdown.tap("rspack:cleanup", () => {
13213
13239
  if (!this.running) {
13214
- this.#instance = void 0;
13240
+ process.nextTick(() => {
13241
+ this.#instance = void 0;
13242
+ this.#compilation && (this.#compilation.__internal__shutdown = true);
13243
+ });
13215
13244
  }
13216
13245
  });
13217
13246
  }
@@ -15266,7 +15295,7 @@ _MemoryCachePlugin.PLUGIN_NAME = "MemoryCachePlugin";
15266
15295
  var MemoryCachePlugin = _MemoryCachePlugin;
15267
15296
 
15268
15297
  // src/stats/DefaultStatsFactoryPlugin.ts
15269
- var util3 = __toESM(require("util"));
15298
+ var util4 = __toESM(require("util"));
15270
15299
 
15271
15300
  // src/stats/statsFactoryUtils.ts
15272
15301
  var iterateConfig = (config2, options, fn2) => {
@@ -16131,7 +16160,7 @@ var SIMPLE_EXTRACTORS = {
16131
16160
  if (depthInCollapsedGroup > 0) depthInCollapsedGroup--;
16132
16161
  continue;
16133
16162
  }
16134
- const message = entry2.args && entry2.args.length > 0 ? util3.format(entry2.args[0], ...entry2.args.slice(1)) : "";
16163
+ const message = entry2.args && entry2.args.length > 0 ? util4.format(entry2.args[0], ...entry2.args.slice(1)) : "";
16135
16164
  const newEntry = {
16136
16165
  type,
16137
16166
  message,
@@ -18920,7 +18949,7 @@ var createConsoleLogger = ({
18920
18949
  };
18921
18950
 
18922
18951
  // src/node/NodeWatchFileSystem.ts
18923
- var import_node_util5 = __toESM(require("util"));
18952
+ var import_node_util6 = __toESM(require("util"));
18924
18953
  var import_watchpack = __toESM(require("../compiled/watchpack/index.js"));
18925
18954
  var NodeWatchFileSystem = class {
18926
18955
  constructor(inputFileSystem) {
@@ -19005,7 +19034,7 @@ var NodeWatchFileSystem = class {
19005
19034
  this.watcher.pause();
19006
19035
  }
19007
19036
  },
19008
- getAggregatedRemovals: import_node_util5.default.deprecate(
19037
+ getAggregatedRemovals: import_node_util6.default.deprecate(
19009
19038
  () => {
19010
19039
  var _a, _b, _c;
19011
19040
  const items = (_a = this.watcher) == null ? void 0 : _a.aggregatedRemovals;
@@ -19020,7 +19049,7 @@ var NodeWatchFileSystem = class {
19020
19049
  "Watcher.getAggregatedRemovals is deprecated in favor of Watcher.getInfo since that's more performant.",
19021
19050
  "DEP_WEBPACK_WATCHER_GET_AGGREGATED_REMOVALS"
19022
19051
  ),
19023
- getAggregatedChanges: import_node_util5.default.deprecate(
19052
+ getAggregatedChanges: import_node_util6.default.deprecate(
19024
19053
  () => {
19025
19054
  var _a, _b, _c;
19026
19055
  const items = (_a = this.watcher) == null ? void 0 : _a.aggregatedChanges;
@@ -19035,14 +19064,14 @@ var NodeWatchFileSystem = class {
19035
19064
  "Watcher.getAggregatedChanges is deprecated in favor of Watcher.getInfo since that's more performant.",
19036
19065
  "DEP_WEBPACK_WATCHER_GET_AGGREGATED_CHANGES"
19037
19066
  ),
19038
- getFileTimeInfoEntries: import_node_util5.default.deprecate(
19067
+ getFileTimeInfoEntries: import_node_util6.default.deprecate(
19039
19068
  () => {
19040
19069
  return fetchTimeInfo().fileTimeInfoEntries;
19041
19070
  },
19042
19071
  "Watcher.getFileTimeInfoEntries is deprecated in favor of Watcher.getInfo since that's more performant.",
19043
19072
  "DEP_WEBPACK_WATCHER_FILE_TIME_INFO_ENTRIES"
19044
19073
  ),
19045
- getContextTimeInfoEntries: import_node_util5.default.deprecate(
19074
+ getContextTimeInfoEntries: import_node_util6.default.deprecate(
19046
19075
  () => {
19047
19076
  return fetchTimeInfo().contextTimeInfoEntries;
19048
19077
  },
@@ -19079,7 +19108,7 @@ var NodeWatchFileSystem = class {
19079
19108
  };
19080
19109
 
19081
19110
  // src/node/nodeConsole.ts
19082
- var util5 = __toESM(require("util"));
19111
+ var util6 = __toESM(require("util"));
19083
19112
 
19084
19113
  // src/logging/truncateArgs.ts
19085
19114
  var arraySum = (array) => {
@@ -19179,7 +19208,7 @@ ${prefix}`);
19179
19208
  if (currentCollapsed > 0) return;
19180
19209
  clearStatusMessage();
19181
19210
  const str = indent3(
19182
- util5.format(...args),
19211
+ util6.format(...args),
19183
19212
  prefix,
19184
19213
  colorPrefix,
19185
19214
  colorSuffix
@@ -19854,7 +19883,7 @@ var config = {
19854
19883
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
19855
19884
  applyWebpackOptionsDefaults: applyRspackOptionsDefaults
19856
19885
  };
19857
- var util6 = { createHash, cleverMerge: cachedCleverMerge };
19886
+ var util7 = { createHash, cleverMerge: cachedCleverMerge };
19858
19887
  var web = {
19859
19888
  FetchCompileAsyncWasmPlugin
19860
19889
  };
@@ -19897,7 +19926,7 @@ var experiments2 = {
19897
19926
 
19898
19927
  // src/rspack.ts
19899
19928
  var import_node_assert9 = __toESM(require("assert"));
19900
- var import_node_util6 = __toESM(require("util"));
19929
+ var import_node_util7 = __toESM(require("util"));
19901
19930
  function createMultiCompiler(options) {
19902
19931
  const compilers = options.map(createCompiler);
19903
19932
  const compiler = new MultiCompiler(
@@ -19985,7 +20014,7 @@ function rspack2(options, callback) {
19985
20014
  } else {
19986
20015
  const { compiler, watch: watch2 } = create3();
19987
20016
  if (watch2) {
19988
- import_node_util6.default.deprecate(
20017
+ import_node_util7.default.deprecate(
19989
20018
  () => {
19990
20019
  },
19991
20020
  "A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."
@@ -1,10 +1,8 @@
1
1
  type CallFn<D> = (args: D[]) => void;
2
2
  export default class MergeCaller<D> {
3
- private timer;
4
3
  private callArgs;
5
- private debounceTime;
6
4
  private callFn;
7
- constructor(fn: CallFn<D>, debounceTime: number);
5
+ constructor(fn: CallFn<D>);
8
6
  private finalCall;
9
7
  push(...data: D[]): void;
10
8
  }
@@ -1,7 +1,7 @@
1
- import type { JsCompatSource } from "@rspack/binding";
1
+ import type { JsCompatSourceOwned } from "@rspack/binding";
2
2
  import { Source } from "../../compiled/webpack-sources";
3
3
  declare class JsSource extends Source {
4
- static __from_binding(source: JsCompatSource): Source;
5
- static __to_binding(source: Source): JsCompatSource;
4
+ static __from_binding(source: JsCompatSourceOwned): Source;
5
+ static __to_binding(source: Source): JsCompatSourceOwned;
6
6
  }
7
7
  export { JsSource };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -61,7 +61,7 @@
61
61
  "@module-federation/runtime-tools": "0.5.1",
62
62
  "@rspack/lite-tapable": "1.0.1",
63
63
  "caniuse-lite": "^1.0.30001616",
64
- "@rspack/binding": "1.1.4"
64
+ "@rspack/binding": "1.1.5"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@swc/helpers": ">=0.5.1"