@rspack/browser 2.1.0-rc.0 → 2.1.1

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.
package/dist/Module.d.ts CHANGED
@@ -5,7 +5,6 @@ import './BuildInfo';
5
5
  export type ResourceDataWithData = ResourceData & {
6
6
  data?: Record<string, any>;
7
7
  };
8
- export type CreateData = binding.JsCreateData;
9
8
  export type ContextInfo = binding.ContextInfo;
10
9
  export type ResolveData = binding.JsResolveData;
11
10
  export declare class ContextModuleFactoryBeforeResolveData {
@@ -1,9 +1,28 @@
1
+ import { EventEmitter } from 'node:events';
1
2
  import binding from './binding';
2
3
  import type Watchpack from 'watchpack';
3
4
  import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } from './util/fs';
5
+ /**
6
+ * Minimal watchpack-compatible shim exposed as `NativeWatchFileSystem.watcher`.
7
+ *
8
+ * It proxies the watchpack-private surface that `ts-checker-rspack-plugin` and
9
+ * `fork-ts-checker-webpack-plugin` rely on — `on`/`once` for `change`/`remove`,
10
+ * plus `_onChange`/`_onRemove` to inject events — onto the native watcher, so
11
+ * those plugins keep working under `experiments.nativeWatcher` unmodified.
12
+ *
13
+ * APIs that iterate `fileWatchers`/`directoryWatchers` are intentionally not
14
+ * supported; plugins needing those should use `WatchFileSystem.emit` instead.
15
+ */
16
+ declare class NativeWatcherShim extends EventEmitter {
17
+ #private;
18
+ constructor(trigger: (kind: 'change' | 'remove', path: string) => void);
19
+ _onChange(item: string, _mtime?: number, file?: string, _type?: string): void;
20
+ _onRemove(item: string, file?: string, _type?: string): void;
21
+ }
4
22
  export default class NativeWatchFileSystem implements WatchFileSystem {
5
23
  #private;
6
24
  constructor(inputFileSystem: InputFileSystem);
25
+ get watcher(): NativeWatcherShim | undefined;
7
26
  watch(files: Iterable<string> & {
8
27
  added?: Iterable<string>;
9
28
  removed?: Iterable<string>;
@@ -16,8 +35,18 @@ export default class NativeWatchFileSystem implements WatchFileSystem {
16
35
  }, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
17
36
  getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
18
37
  triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void;
38
+ on(event: 'change', listener: (filename: string, mtime: number) => void): this;
39
+ on(event: 'remove', listener: (filename: string) => void): this;
40
+ on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
41
+ once(event: 'change', listener: (filename: string, mtime: number) => void): this;
42
+ once(event: 'remove', listener: (filename: string) => void): this;
43
+ once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
44
+ emit(event: 'change', filename: string, mtime: number): boolean;
45
+ emit(event: 'remove', filename: string): boolean;
46
+ emit(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
19
47
  formatWatchDependencies(dependencies: Iterable<string> & {
20
48
  added?: Iterable<string>;
21
49
  removed?: Iterable<string>;
22
50
  }): [string[], string[]];
23
51
  }
52
+ export {};
@@ -345,7 +345,6 @@ declare enum RuntimeGlobals {
345
345
  makeDeferredNamespaceObjectSymbol = 76
346
346
  }
347
347
  export declare const isReservedRuntimeGlobal: (r: string, compilerRuntimeGlobals: Record<string, string>) => boolean;
348
- export declare function renderModulePrefix(_compilerOptions: RspackOptionsNormalized): string;
349
348
  export declare enum RuntimeVariable {
350
349
  Require = 0,
351
350
  Context = 1,
@@ -1,4 +1,4 @@
1
- import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig, TerserEcmaVersion, TransformConfig, TsParserConfig } from '@swc/types';
1
+ import type { Config, EnvConfig, EsParserConfig, JscConfig, ModuleConfig, ParserConfig, TransformConfig, TsParserConfig } from '@swc/types';
2
2
  import type { CollectTypeScriptInfoOptions } from './collectTypeScriptInfo';
3
3
  import type { PluginImportOptions } from './pluginImport';
4
4
  export type SwcLoaderEnvConfig = EnvConfig;
@@ -57,62 +57,4 @@ export interface ReactServerComponentsOptions {
57
57
  */
58
58
  disableClientApiChecks?: boolean;
59
59
  }
60
- export interface TerserCompressOptions {
61
- arguments?: boolean;
62
- arrows?: boolean;
63
- booleans?: boolean;
64
- booleans_as_integers?: boolean;
65
- collapse_vars?: boolean;
66
- comparisons?: boolean;
67
- computed_props?: boolean;
68
- conditionals?: boolean;
69
- dead_code?: boolean;
70
- defaults?: boolean;
71
- directives?: boolean;
72
- drop_console?: boolean;
73
- drop_debugger?: boolean;
74
- ecma?: TerserEcmaVersion;
75
- evaluate?: boolean;
76
- expression?: boolean;
77
- global_defs?: any;
78
- hoist_funs?: boolean;
79
- hoist_props?: boolean;
80
- hoist_vars?: boolean;
81
- ie8?: boolean;
82
- if_return?: boolean;
83
- inline?: 0 | 1 | 2 | 3;
84
- join_vars?: boolean;
85
- keep_classnames?: boolean;
86
- keep_fargs?: boolean;
87
- keep_fnames?: boolean;
88
- keep_infinity?: boolean;
89
- loops?: boolean;
90
- negate_iife?: boolean;
91
- passes?: number;
92
- properties?: boolean;
93
- pure_getters?: any;
94
- pure_funcs?: string[];
95
- reduce_funcs?: boolean;
96
- reduce_vars?: boolean;
97
- sequences?: any;
98
- side_effects?: boolean;
99
- switches?: boolean;
100
- top_retain?: any;
101
- toplevel?: any;
102
- typeofs?: boolean;
103
- unsafe?: boolean;
104
- unsafe_passes?: boolean;
105
- unsafe_arrows?: boolean;
106
- unsafe_comps?: boolean;
107
- unsafe_function?: boolean;
108
- unsafe_math?: boolean;
109
- unsafe_symbols?: boolean;
110
- unsafe_methods?: boolean;
111
- unsafe_proto?: boolean;
112
- unsafe_regexp?: boolean;
113
- unsafe_undefined?: boolean;
114
- unused?: boolean;
115
- const_to_let?: boolean;
116
- module?: boolean;
117
- }
118
60
  export {};
@@ -182,7 +182,7 @@ export interface TerserCompressOptions {
182
182
  unsafe_passes?: boolean;
183
183
  unsafe_arrows?: boolean;
184
184
  unsafe_comps?: boolean;
185
- unsafe_function?: boolean;
185
+ unsafe_Function?: boolean;
186
186
  unsafe_math?: boolean;
187
187
  unsafe_symbols?: boolean;
188
188
  unsafe_methods?: boolean;
@@ -40,7 +40,7 @@ export type HtmlRspackPluginOptions = {
40
40
  * Modern browsers support non-blocking JavaScript loading ([`defer` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#defer)) to improve the page startup performance.
41
41
  *
42
42
  * Setting this option to `'module'` adds attribute `type="module"` to the `script`. This also implies `defer` attribute on the `script`, since modules are automatically deferred.
43
- * @default "defer"
43
+ * @default "module" when `output.module` is enabled, otherwise "defer"
44
44
  * */
45
45
  scriptLoading?: 'blocking' | 'defer' | 'module' | 'systemjs-module';
46
46
  /** Allows you to add only some chunks. */
@@ -83,6 +83,8 @@ export type CacheNormalized = false | {
83
83
  type: 'persistent';
84
84
  buildDependencies: string[];
85
85
  version?: string;
86
+ maxAge?: number;
87
+ maxVersions?: number;
86
88
  snapshot: {
87
89
  immutablePaths?: (string | RegExp)[];
88
90
  unmanagedPaths?: (string | RegExp)[];
@@ -91,8 +93,6 @@ export type CacheNormalized = false | {
91
93
  storage: {
92
94
  type: 'filesystem';
93
95
  directory?: string;
94
- maxAge?: number;
95
- maxGenerations?: number;
96
96
  };
97
97
  portable?: boolean;
98
98
  readonly?: boolean;
@@ -1378,19 +1378,6 @@ export type CacheStorageOptions = {
1378
1378
  * @default 'node_modules/.cache/rspack/<name>-<mode>-<compilerIndex>'
1379
1379
  */
1380
1380
  directory?: string;
1381
- /**
1382
- * Maximum age of unused filesystem cache in seconds. Must be an integer
1383
- * between 1 and 4294967295, or Infinity to disable age-based cleanup.
1384
- * @default 7 * 24 * 60 * 60
1385
- */
1386
- maxAge?: number;
1387
- /**
1388
- * Maximum number of filesystem cache generations to retain in the cache
1389
- * directory. Must be an integer between 1 and 4294967295, or Infinity to
1390
- * disable generation-based cleanup.
1391
- * @default 3
1392
- */
1393
- maxGenerations?: number;
1394
1381
  };
1395
1382
  /**
1396
1383
  * Persistent cache options.
@@ -1410,6 +1397,19 @@ export type PersistentCacheOptions = {
1410
1397
  * @default ""
1411
1398
  */
1412
1399
  version?: string;
1400
+ /**
1401
+ * Maximum age of unused filesystem cache in seconds. Must be an integer
1402
+ * between 1 and 4294967295, or Infinity to disable age-based cleanup.
1403
+ * @default 7 * 24 * 60 * 60
1404
+ */
1405
+ maxAge?: number;
1406
+ /**
1407
+ * Maximum number of filesystem cache versions to retain in the cache
1408
+ * directory. Must be an integer between 1 and 4294967295, or Infinity to
1409
+ * disable version-based cleanup.
1410
+ * @default 3
1411
+ */
1412
+ maxVersions?: number;
1413
1413
  /**
1414
1414
  * Snapshot options for determining which files have been modified.
1415
1415
  */
package/dist/index.js CHANGED
@@ -8626,7 +8626,7 @@ __webpack_require__.add({
8626
8626
  module.exports = modes;
8627
8627
  },
8628
8628
  37481 (__unused_rspack_module, exports, __webpack_require__) {
8629
- var Buffer = __webpack_require__(71015).h;
8629
+ var Buffer = __webpack_require__(98041).h;
8630
8630
  var xor = __webpack_require__(10460);
8631
8631
  function getBlock(self1) {
8632
8632
  self1._prev = self1._cipher.encryptBlock(self1._prev);
@@ -9143,7 +9143,7 @@ __webpack_require__.add({
9143
9143
  module.exports = verify;
9144
9144
  },
9145
9145
  46025 (__unused_rspack_module, exports, __webpack_require__) {
9146
- var Buffer = __webpack_require__(71015).h;
9146
+ var Buffer = __webpack_require__(98041).h;
9147
9147
  var process = __webpack_require__(85409);
9148
9148
  var assert = __webpack_require__(46732);
9149
9149
  var Zstream = __webpack_require__(84179);
@@ -9818,7 +9818,7 @@ __webpack_require__.add({
9818
9818
  util.inherits(Unzip, Zlib);
9819
9819
  },
9820
9820
  10460 (module, __unused_rspack_exports, __webpack_require__) {
9821
- var Buffer = __webpack_require__(71015).h;
9821
+ var Buffer = __webpack_require__(98041).h;
9822
9822
  module.exports = function(a, b) {
9823
9823
  var length = Math.min(a.length, b.length);
9824
9824
  var buffer = new Buffer(length);
@@ -11184,7 +11184,7 @@ __webpack_require__.add({
11184
11184
  }
11185
11185
  },
11186
11186
  29520 (module, __unused_rspack_exports, __webpack_require__) {
11187
- var Buffer = __webpack_require__(71015).h;
11187
+ var Buffer = __webpack_require__(98041).h;
11188
11188
  var elliptic = __webpack_require__(23071);
11189
11189
  var BN = __webpack_require__(5630);
11190
11190
  module.exports = function(curve) {
@@ -12569,8 +12569,8 @@ __webpack_require__.add({
12569
12569
  };
12570
12570
  },
12571
12571
  58216 (__unused_rspack_module, exports, __webpack_require__) {
12572
- var Buffer = __webpack_require__(71015).h;
12573
- var generatePrime = __webpack_require__(25122);
12572
+ var Buffer = __webpack_require__(98041).h;
12573
+ var generatePrime = __webpack_require__(2741);
12574
12574
  var primes = __webpack_require__(37821);
12575
12575
  var DH = __webpack_require__(29242);
12576
12576
  function getDiffieHellman(mod) {
@@ -12599,7 +12599,7 @@ __webpack_require__.add({
12599
12599
  exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;
12600
12600
  },
12601
12601
  29242 (module, __unused_rspack_exports, __webpack_require__) {
12602
- var Buffer = __webpack_require__(71015).h;
12602
+ var Buffer = __webpack_require__(98041).h;
12603
12603
  var BN = __webpack_require__(5630);
12604
12604
  var MillerRabin = __webpack_require__(74442);
12605
12605
  var millerRabin = new MillerRabin();
@@ -12608,7 +12608,7 @@ __webpack_require__.add({
12608
12608
  var TEN = new BN(10);
12609
12609
  var THREE = new BN(3);
12610
12610
  var SEVEN = new BN(7);
12611
- var primes = __webpack_require__(25122);
12611
+ var primes = __webpack_require__(2741);
12612
12612
  var randomBytes = __webpack_require__(82869);
12613
12613
  module.exports = DH;
12614
12614
  function setPublicKey(pub, enc) {
@@ -12721,7 +12721,7 @@ __webpack_require__.add({
12721
12721
  return buf.toString(enc);
12722
12722
  }
12723
12723
  },
12724
- 25122 (module, __unused_rspack_exports, __webpack_require__) {
12724
+ 2741 (module, __unused_rspack_exports, __webpack_require__) {
12725
12725
  var randomBytes = __webpack_require__(82869);
12726
12726
  module.exports = findPrime;
12727
12727
  findPrime.simpleSieve = simpleSieve;
@@ -15725,7 +15725,7 @@ __webpack_require__.add({
15725
15725
  utils.intFromLE = intFromLE;
15726
15726
  },
15727
15727
  90710 (module, __unused_rspack_exports, __webpack_require__) {
15728
- var Buffer = __webpack_require__(71015).h;
15728
+ var Buffer = __webpack_require__(98041).h;
15729
15729
  const { nextTick } = __webpack_require__(41732);
15730
15730
  const dirname = (path)=>{
15731
15731
  let idx = path.length - 1;
@@ -17031,7 +17031,7 @@ __webpack_require__.add({
17031
17031
  },
17032
17032
  70627 (module, __unused_rspack_exports, __webpack_require__) {
17033
17033
  var process = __webpack_require__(85409);
17034
- var fs = __webpack_require__(72022);
17034
+ var fs = __webpack_require__(55016);
17035
17035
  var polyfills = __webpack_require__(58254);
17036
17036
  var legacy = __webpack_require__(60111);
17037
17037
  var clone = __webpack_require__(58359);
@@ -30981,7 +30981,7 @@ __webpack_require__.add({
30981
30981
  xhr = null;
30982
30982
  },
30983
30983
  3040 (module, __unused_rspack_exports, __webpack_require__) {
30984
- var Buffer = __webpack_require__(71015).h;
30984
+ var Buffer = __webpack_require__(98041).h;
30985
30985
  var process = __webpack_require__(85409);
30986
30986
  var capability = __webpack_require__(89771);
30987
30987
  var inherits = __webpack_require__(91193);
@@ -31233,7 +31233,7 @@ __webpack_require__.add({
31233
31233
  },
31234
31234
  40506 (__unused_rspack_module, exports, __webpack_require__) {
31235
31235
  var process = __webpack_require__(85409);
31236
- var Buffer = __webpack_require__(71015).h;
31236
+ var Buffer = __webpack_require__(98041).h;
31237
31237
  var capability = __webpack_require__(89771);
31238
31238
  var inherits = __webpack_require__(91193);
31239
31239
  var stream = __webpack_require__(51094);
@@ -33690,7 +33690,7 @@ __webpack_require__.add({
33690
33690
  },
33691
33691
  7097 (module, __unused_rspack_exports, __webpack_require__) {
33692
33692
  var process = __webpack_require__(85409);
33693
- const fs = __webpack_require__(72022);
33693
+ const fs = __webpack_require__(55016);
33694
33694
  const path = __webpack_require__(13078);
33695
33695
  const EXPECTED_ERRORS = new Set([
33696
33696
  "EINVAL",
@@ -34309,7 +34309,7 @@ __webpack_require__.add({
34309
34309
  2071 (module, __unused_rspack_exports, __webpack_require__) {
34310
34310
  var process = __webpack_require__(85409);
34311
34311
  const { EventEmitter } = __webpack_require__(80381);
34312
- const fs = __webpack_require__(72022);
34312
+ const fs = __webpack_require__(55016);
34313
34313
  const path = __webpack_require__(13078);
34314
34314
  const reducePlan = __webpack_require__(92322);
34315
34315
  const IS_OSX = "darwin" === __webpack_require__(35207).iD();
@@ -34554,7 +34554,7 @@ __webpack_require__.add({
34554
34554
  };
34555
34555
  },
34556
34556
  45250 (module, __unused_rspack_exports, __webpack_require__) {
34557
- var Buffer = __webpack_require__(71015).h;
34557
+ var Buffer = __webpack_require__(98041).h;
34558
34558
  const Source = __webpack_require__(16604);
34559
34559
  const streamAndGetSourceAndMap = __webpack_require__(57404);
34560
34560
  const streamChunksOfRawSource = __webpack_require__(16689);
@@ -34845,7 +34845,7 @@ __webpack_require__.add({
34845
34845
  module.exports = CompatSource;
34846
34846
  },
34847
34847
  40884 (module, __unused_rspack_exports, __webpack_require__) {
34848
- var Buffer = __webpack_require__(71015).h;
34848
+ var Buffer = __webpack_require__(98041).h;
34849
34849
  const RawSource = __webpack_require__(82386);
34850
34850
  const Source = __webpack_require__(16604);
34851
34851
  const { getMap, getSourceAndMap } = __webpack_require__(34681);
@@ -35069,7 +35069,7 @@ __webpack_require__.add({
35069
35069
  module.exports = ConcatSource;
35070
35070
  },
35071
35071
  65963 (module, __unused_rspack_exports, __webpack_require__) {
35072
- var Buffer = __webpack_require__(71015).h;
35072
+ var Buffer = __webpack_require__(98041).h;
35073
35073
  const Source = __webpack_require__(16604);
35074
35074
  const { getMap, getSourceAndMap } = __webpack_require__(34681);
35075
35075
  const getGeneratedSourceInfo = __webpack_require__(68811);
@@ -35196,7 +35196,7 @@ __webpack_require__.add({
35196
35196
  module.exports = OriginalSource;
35197
35197
  },
35198
35198
  55424 (module, __unused_rspack_exports, __webpack_require__) {
35199
- var Buffer = __webpack_require__(71015).h;
35199
+ var Buffer = __webpack_require__(98041).h;
35200
35200
  const RawSource = __webpack_require__(82386);
35201
35201
  const Source = __webpack_require__(16604);
35202
35202
  const { getMap, getSourceAndMap } = __webpack_require__(34681);
@@ -35267,7 +35267,7 @@ __webpack_require__.add({
35267
35267
  module.exports = PrefixSource;
35268
35268
  },
35269
35269
  82386 (module, __unused_rspack_exports, __webpack_require__) {
35270
- var Buffer = __webpack_require__(71015).h;
35270
+ var Buffer = __webpack_require__(98041).h;
35271
35271
  const Source = __webpack_require__(16604);
35272
35272
  const streamChunksOfRawSource = __webpack_require__(16689);
35273
35273
  const { internString, isDualStringBufferCachingEnabled } = __webpack_require__(5895);
@@ -35667,7 +35667,7 @@ __webpack_require__.add({
35667
35667
  module.exports = SizeOnlySource;
35668
35668
  },
35669
35669
  16604 (module, __unused_rspack_exports, __webpack_require__) {
35670
- var Buffer = __webpack_require__(71015).h;
35670
+ var Buffer = __webpack_require__(98041).h;
35671
35671
  class Source {
35672
35672
  source() {
35673
35673
  throw new Error("Abstract");
@@ -35702,7 +35702,7 @@ __webpack_require__.add({
35702
35702
  module.exports = Source;
35703
35703
  },
35704
35704
  17061 (module, __unused_rspack_exports, __webpack_require__) {
35705
- var Buffer = __webpack_require__(71015).h;
35705
+ var Buffer = __webpack_require__(98041).h;
35706
35706
  const Source = __webpack_require__(16604);
35707
35707
  const { getMap, getSourceAndMap } = __webpack_require__(34681);
35708
35708
  const streamChunksOfCombinedSourceMap = __webpack_require__(50226);
@@ -36848,16 +36848,16 @@ __webpack_require__.add({
36848
36848
  return target;
36849
36849
  }
36850
36850
  },
36851
- 71015 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
36851
+ 98041 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
36852
36852
  var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__(31737);
36853
36853
  __webpack_require__.d(__webpack_exports__, {
36854
36854
  h: ()=>_napi_rs_wasm_runtime_fs__rspack_import_0.hp
36855
36855
  });
36856
36856
  },
36857
- 72022 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
36857
+ 55016 (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
36858
36858
  __webpack_require__.r(__webpack_exports__);
36859
36859
  var _napi_rs_wasm_runtime_fs__rspack_import_0 = __webpack_require__(31737);
36860
- var _rspack_binding__rspack_import_1 = __webpack_require__(88552);
36860
+ var _rspack_binding__rspack_import_1 = __webpack_require__(30977);
36861
36861
  const fs = _rspack_binding__rspack_import_1.__fs;
36862
36862
  const volume = _rspack_binding__rspack_import_1.__volume;
36863
36863
  const memfs = _napi_rs_wasm_runtime_fs__rspack_import_0.tO;
@@ -36876,7 +36876,7 @@ __webpack_require__.add({
36876
36876
  watch: watch
36877
36877
  });
36878
36878
  },
36879
- 88552 (module) {
36879
+ 30977 (module) {
36880
36880
  module.exports = __rspack_external__rspack_wasi_browser_js_bd433424;
36881
36881
  },
36882
36882
  39699 () {},
@@ -56134,6 +56134,7 @@ const compareIds = (a, b)=>{
56134
56134
  if (a > b) return 1;
56135
56135
  return 0;
56136
56136
  };
56137
+ const compareNumbers = compareIds;
56137
56138
  const compareSelectCache = new TwoKeyWeakMap();
56138
56139
  const compareSelect = (getter, comparator)=>{
56139
56140
  const cacheEntry = compareSelectCache.get(getter, comparator);
@@ -56151,12 +56152,6 @@ const compareSelect = (getter, comparator)=>{
56151
56152
  compareSelectCache.set(getter, comparator, result);
56152
56153
  return result;
56153
56154
  };
56154
- const compareNumbers = (a, b)=>{
56155
- if (typeof a !== typeof b) return typeof a < typeof b ? -1 : 1;
56156
- if (a < b) return -1;
56157
- if (a > b) return 1;
56158
- return 0;
56159
- };
56160
56155
  const smartGrouping = (items, groupConfigs)=>{
56161
56156
  const itemsWithGroups = new Set();
56162
56157
  const allGroups = new Map();
@@ -56662,7 +56657,7 @@ function createFakeCompilationDependencies(getDeps, addDeps) {
56662
56657
  };
56663
56658
  }
56664
56659
  const webpack_sources_lib = __webpack_require__("72105");
56665
- var Buffer = __webpack_require__(71015).h;
56660
+ var Buffer = __webpack_require__(98041).h;
56666
56661
  class SourceAdapter {
56667
56662
  static fromBinding(source) {
56668
56663
  if (!source.map) return new webpack_sources_lib.RawSource(source.source);
@@ -58246,7 +58241,7 @@ function applyLimits(options) {
58246
58241
  base_create(external_rspack_wasi_browser_js_BuiltinPluginName.EsmNodeTargetPlugin, ()=>void 0);
58247
58242
  const EvalDevToolModulePlugin = base_create(external_rspack_wasi_browser_js_BuiltinPluginName.EvalDevToolModulePlugin, (options)=>options, 'compilation');
58248
58243
  const EvalSourceMapDevToolPlugin = base_create(external_rspack_wasi_browser_js_BuiltinPluginName.EvalSourceMapDevToolPlugin, (options)=>options, 'compilation');
58249
- var util_Buffer = __webpack_require__(71015).h;
58244
+ var util_Buffer = __webpack_require__(98041).h;
58250
58245
  function isNil(value) {
58251
58246
  return null == value;
58252
58247
  }
@@ -58267,10 +58262,10 @@ const toObject = (input)=>{
58267
58262
  function serializeObject(map) {
58268
58263
  if (isNil(map)) return;
58269
58264
  if ('string' == typeof map) {
58270
- if (map) return toBuffer(map);
58265
+ if (map) return util_Buffer.from(map);
58271
58266
  return;
58272
58267
  }
58273
- return toBuffer(JSON.stringify(map));
58268
+ return util_Buffer.from(JSON.stringify(map));
58274
58269
  }
58275
58270
  function util_indent(str, prefix) {
58276
58271
  const rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
@@ -58757,11 +58752,11 @@ function getRawCache(cache) {
58757
58752
  };
58758
58753
  return {
58759
58754
  ...cache,
58755
+ maxAge: toRawStorageLimit('cache.maxAge', cache.maxAge),
58756
+ maxVersions: toRawStorageLimit('cache.maxVersions', cache.maxVersions),
58760
58757
  storage: {
58761
58758
  ...cache.storage,
58762
- directory: cache.storage.directory,
58763
- maxAge: toRawStorageLimit('cache.storage.maxAge', cache.storage.maxAge),
58764
- maxGenerations: toRawStorageLimit('cache.storage.maxGenerations', cache.storage.maxGenerations)
58759
+ directory: cache.storage.directory
58765
58760
  },
58766
58761
  snapshot: {
58767
58762
  immutablePaths: cache.snapshot.immutablePaths,
@@ -59387,7 +59382,7 @@ const memoizeFn = (fn)=>{
59387
59382
  return cache(...args);
59388
59383
  };
59389
59384
  };
59390
- var HttpUriPlugin_Buffer = __webpack_require__(71015).h;
59385
+ var HttpUriPlugin_Buffer = __webpack_require__(98041).h;
59391
59386
  memoize(()=>__webpack_require__(87069));
59392
59387
  memoize(()=>__webpack_require__(84033));
59393
59388
  const defaultHttpClientForBrowser = async (url, headers)=>{
@@ -59473,7 +59468,7 @@ const getPluginHooks = (compilation)=>{
59473
59468
  const cleanPluginHooks = (compilation)=>{
59474
59469
  hooks_compilationHooksMap.delete(compilation);
59475
59470
  };
59476
- const fs_0 = __webpack_require__("72022");
59471
+ const fs_0 = __webpack_require__("55016");
59477
59472
  var plugin_process = __webpack_require__(85409);
59478
59473
  let HTML_PLUGIN_UID = 0;
59479
59474
  const HtmlRspackPluginImpl = base_create(external_rspack_wasi_browser_js_BuiltinPluginName.HtmlRspackPlugin, function(c = {}) {
@@ -59490,7 +59485,7 @@ const HtmlRspackPluginImpl = base_create(external_rspack_wasi_browser_js_Builtin
59490
59485
  ...value
59491
59486
  };
59492
59487
  }
59493
- const scriptLoading = c.scriptLoading ?? 'defer';
59488
+ const scriptLoading = c.scriptLoading ?? (this.options.output.module ? 'module' : 'defer');
59494
59489
  const configInject = c.inject ?? true;
59495
59490
  const inject = true === configInject ? 'blocking' === scriptLoading ? 'body' : 'head' : false === configInject ? 'false' : configInject;
59496
59491
  const base = 'string' == typeof c.base ? {
@@ -59956,7 +59951,7 @@ class Hash {
59956
59951
  throw new AbstractMethodError();
59957
59952
  }
59958
59953
  }
59959
- var wasm_hash_Buffer = __webpack_require__(71015).h;
59954
+ var wasm_hash_Buffer = __webpack_require__(98041).h;
59960
59955
  const MAX_SHORT_STRING = -4 & Math.floor(16368);
59961
59956
  class WasmHash {
59962
59957
  exports;
@@ -60075,7 +60070,7 @@ const wasm_hash_create = (wasmModule, instancesPool, chunkSize, digestSize)=>{
60075
60070
  return new WasmHash(new WebAssembly.Instance(wasmModule), instancesPool, chunkSize, digestSize);
60076
60071
  };
60077
60072
  const wasm_hash = wasm_hash_create;
60078
- var md4_Buffer = __webpack_require__(71015).h;
60073
+ var md4_Buffer = __webpack_require__(98041).h;
60079
60074
  let createMd4;
60080
60075
  const hash_md4 = ()=>{
60081
60076
  if (!createMd4) {
@@ -60084,7 +60079,7 @@ const hash_md4 = ()=>{
60084
60079
  }
60085
60080
  return createMd4();
60086
60081
  };
60087
- var xxhash64_Buffer = __webpack_require__(71015).h;
60082
+ var xxhash64_Buffer = __webpack_require__(98041).h;
60088
60083
  let createXxhash64;
60089
60084
  const hash_xxhash64 = ()=>{
60090
60085
  if (!createXxhash64) {
@@ -60093,7 +60088,7 @@ const hash_xxhash64 = ()=>{
60093
60088
  }
60094
60089
  return createXxhash64();
60095
60090
  };
60096
- var createHash_Buffer = __webpack_require__(71015).h;
60091
+ var createHash_Buffer = __webpack_require__(98041).h;
60097
60092
  const BULK_SIZE = 2000;
60098
60093
  const digestCaches = {};
60099
60094
  class BulkUpdateDecorator extends Hash {
@@ -60248,7 +60243,7 @@ function handleResult(loader, module, callback) {
60248
60243
  if ('function' != typeof loader.normal && 'function' != typeof loader.pitch) return callback(new LoaderLoadingError(`Module '${loader.path}' is not a loader (must have normal or pitch function)`));
60249
60244
  callback();
60250
60245
  }
60251
- var utils_Buffer = __webpack_require__(71015).h;
60246
+ var utils_Buffer = __webpack_require__(98041).h;
60252
60247
  const decoder = new TextDecoder();
60253
60248
  function utf8BufferToString(buf) {
60254
60249
  const isShared = buf.buffer instanceof SharedArrayBuffer || buf.buffer.constructor?.name === 'SharedArrayBuffer';
@@ -60955,7 +60950,9 @@ async function runLoaders(compiler, context) {
60955
60950
  case JsLoaderState.Normal:
60956
60951
  {
60957
60952
  let content = context.content;
60958
- let sourceMap = JsSourceMap.__from_binding(context.sourceMap);
60953
+ const rawSourceMap = context.sourceMap;
60954
+ let sourceMap;
60955
+ let sourceMapParsed = false;
60959
60956
  let additionalData = context.additionalData;
60960
60957
  while(loaderContext.loaderIndex >= 0){
60961
60958
  const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
@@ -60969,6 +60966,10 @@ async function runLoaders(compiler, context) {
60969
60966
  const fn = currentLoaderObject.normal;
60970
60967
  if (!parallelism || !fn) currentLoaderObject.normalExecuted = true;
60971
60968
  if (!fn) continue;
60969
+ if (!sourceMapParsed) {
60970
+ sourceMap = JsSourceMap.__from_binding(rawSourceMap);
60971
+ sourceMapParsed = true;
60972
+ }
60972
60973
  [content, sourceMap, additionalData] = await isomorphoicRun(fn, [
60973
60974
  content,
60974
60975
  sourceMap,
@@ -60976,7 +60977,7 @@ async function runLoaders(compiler, context) {
60976
60977
  ]);
60977
60978
  }
60978
60979
  context.content = isNil(content) ? null : toBuffer(content);
60979
- context.sourceMap = JsSourceMap.__to_binding(sourceMap);
60980
+ context.sourceMap = sourceMapParsed ? JsSourceMap.__to_binding(sourceMap) : rawSourceMap;
60980
60981
  context.additionalData = additionalData || void 0;
60981
60982
  context.__internal__utf8Hint = 'string' == typeof content;
60982
60983
  break;
@@ -61386,7 +61387,7 @@ const SizeLimitsPlugin = base_create(external_rspack_wasi_browser_js_BuiltinPlug
61386
61387
  };
61387
61388
  });
61388
61389
  const SourceMapDevToolPlugin = base_create(external_rspack_wasi_browser_js_BuiltinPluginName.SourceMapDevToolPlugin, (options)=>options, 'compilation');
61389
- var SubresourceIntegrityPlugin_Buffer = __webpack_require__(71015).h;
61390
+ var SubresourceIntegrityPlugin_Buffer = __webpack_require__(98041).h;
61390
61391
  const SubresourceIntegrityPlugin_PLUGIN_NAME = 'SubresourceIntegrityPlugin';
61391
61392
  const NATIVE_HTML_PLUGIN = 'HtmlRspackPlugin';
61392
61393
  const HTTP_PROTOCOL_REGEX = /^https?:/;
@@ -63096,6 +63097,8 @@ const applyCacheDefaults = (cache, { context, name, mode, compilerIndex })=>{
63096
63097
  break;
63097
63098
  case 'persistent':
63098
63099
  D(cache, 'version', '');
63100
+ D(cache, 'maxAge', DEFAULT_FILESYSTEM_CACHE_MAX_AGE_SECONDS);
63101
+ D(cache, 'maxVersions', 3);
63099
63102
  F(cache, 'buildDependencies', ()=>[]);
63100
63103
  F(cache.snapshot, 'immutablePaths', ()=>[]);
63101
63104
  F(cache.snapshot, 'unmanagedPaths', ()=>[]);
@@ -63103,8 +63106,6 @@ const applyCacheDefaults = (cache, { context, name, mode, compilerIndex })=>{
63103
63106
  /[\\/]node_modules[\\/][^.]/
63104
63107
  ]);
63105
63108
  D(cache.storage, 'type', 'filesystem');
63106
- D(cache.storage, 'maxAge', DEFAULT_FILESYSTEM_CACHE_MAX_AGE_SECONDS);
63107
- D(cache.storage, 'maxGenerations', 3);
63108
63109
  F(cache.storage, 'directory', ()=>{
63109
63110
  const modeName = mode || 'production';
63110
63111
  const compilerName = name ? `${name}-${modeName}` : modeName;
@@ -63609,7 +63610,7 @@ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffecte
63609
63610
  });
63610
63611
  D(output, 'bundlerInfo', {});
63611
63612
  if ('object' == typeof output.bundlerInfo) {
63612
- D(output.bundlerInfo, 'version', "2.1.0-rc.0");
63613
+ D(output.bundlerInfo, 'version', "2.1.1");
63613
63614
  D(output.bundlerInfo, 'bundler', 'rspack');
63614
63615
  D(output.bundlerInfo, 'force', false);
63615
63616
  }
@@ -64041,6 +64042,8 @@ const getNormalizedRspackOptions = (config)=>({
64041
64042
  return {
64042
64043
  type: 'persistent',
64043
64044
  version: cache.version,
64045
+ maxAge: cache.maxAge,
64046
+ maxVersions: cache.maxVersions,
64044
64047
  portable: cache.portable,
64045
64048
  readonly: cache.readonly,
64046
64049
  buildDependencies: nestedArray(cache.buildDependencies, (deps)=>deps.map((d)=>path_browserify_default().resolve(context, d))),
@@ -64057,9 +64060,7 @@ const getNormalizedRspackOptions = (config)=>({
64057
64060
  })),
64058
64061
  storage: nestedConfig(cache.storage, (storage)=>({
64059
64062
  type: storage.type,
64060
- directory: optionalNestedConfig(storage.directory, (d)=>path_browserify_default().resolve(context, d)),
64061
- maxAge: storage.maxAge,
64062
- maxGenerations: storage.maxGenerations
64063
+ directory: optionalNestedConfig(storage.directory, (d)=>path_browserify_default().resolve(context, d))
64063
64064
  }))
64064
64065
  };
64065
64066
  }
@@ -64630,7 +64631,7 @@ const mkdirp = (fs, p, callback)=>{
64630
64631
  callback();
64631
64632
  });
64632
64633
  };
64633
- var FileSystem_Buffer = __webpack_require__(71015).h;
64634
+ var FileSystem_Buffer = __webpack_require__(98041).h;
64634
64635
  const BUFFER_SIZE = 1000;
64635
64636
  const ASYNC_NOOP = async ()=>{};
64636
64637
  const NOOP_FILESYSTEM = {
@@ -65317,7 +65318,7 @@ class MultiStats {
65317
65318
  return obj;
65318
65319
  });
65319
65320
  if (childOptions.version) {
65320
- obj.rspackVersion = "2.1.0-rc.0";
65321
+ obj.rspackVersion = "2.1.1";
65321
65322
  obj.version = "5.75.0";
65322
65323
  }
65323
65324
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -65883,17 +65884,36 @@ const createConsoleLogger = ({ level = 'info', debug = false, console: console1
65883
65884
  };
65884
65885
  return logger;
65885
65886
  };
65887
+ const events_0 = __webpack_require__("80381");
65886
65888
  const toJsWatcherIgnored = (ignored)=>{
65887
65889
  if (Array.isArray(ignored) || 'string' == typeof ignored || ignored instanceof RegExp) return ignored;
65888
65890
  if ('function' == typeof ignored) throw new Error("NativeWatcher does not support using a function for the 'ignored' option");
65889
65891
  };
65892
+ class NativeWatcherShim extends events_0.EventEmitter {
65893
+ #trigger;
65894
+ constructor(trigger){
65895
+ super();
65896
+ this.#trigger = trigger;
65897
+ }
65898
+ _onChange(item, _mtime, file, _type) {
65899
+ this.#trigger('change', file ?? item);
65900
+ }
65901
+ _onRemove(item, file, _type) {
65902
+ this.#trigger('remove', file ?? item);
65903
+ }
65904
+ }
65890
65905
  class NativeWatchFileSystem {
65891
65906
  #inner;
65892
65907
  #isFirstWatch = true;
65893
65908
  #inputFileSystem;
65909
+ #events = new events_0.EventEmitter();
65910
+ #watcher;
65894
65911
  constructor(inputFileSystem){
65895
65912
  this.#inputFileSystem = inputFileSystem;
65896
65913
  }
65914
+ get watcher() {
65915
+ return this.#watcher;
65916
+ }
65897
65917
  watch(files, directories, missing, startTime, options, callback, callbackUndelayed) {
65898
65918
  if ((!files.added || 'function' != typeof files.added[Symbol.iterator]) && (!files.removed || 'function' != typeof files.removed[Symbol.iterator])) throw new Error("Invalid arguments: 'files'");
65899
65919
  if ((!directories.added || 'function' != typeof directories.added[Symbol.iterator]) && (!directories.removed || 'function' != typeof directories.removed[Symbol.iterator])) throw new Error("Invalid arguments: 'directories'");
@@ -65901,6 +65921,8 @@ class NativeWatchFileSystem {
65901
65921
  if ('object' != typeof options) throw new Error("Invalid arguments: 'options'");
65902
65922
  if ('function' != typeof callbackUndelayed && callbackUndelayed) throw new Error("Invalid arguments: 'callbackUndelayed'");
65903
65923
  const nativeWatcher = this.getNativeWatcher(options);
65924
+ const watcher = new NativeWatcherShim((kind, path)=>this.#inner?.triggerEvent(kind, path));
65925
+ this.#watcher = watcher;
65904
65926
  nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), BigInt(startTime), (err, result)=>{
65905
65927
  if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
65906
65928
  nativeWatcher.pause();
@@ -65911,9 +65933,21 @@ class NativeWatchFileSystem {
65911
65933
  for (const item of changedFiles)fs.purge?.(item);
65912
65934
  for (const item of removedFiles)fs.purge?.(item);
65913
65935
  }
65914
- callback(err, new Map(), new Map(), new Set(changedFiles), new Set(removedFiles));
65915
- }, (fileName)=>{
65916
- callbackUndelayed(fileName, Date.now());
65936
+ const changes = new Set(changedFiles);
65937
+ const removals = new Set(removedFiles);
65938
+ this.#events.emit('aggregated', changes, removals);
65939
+ watcher.emit('aggregated', changes, removals);
65940
+ callback(err, new Map(), new Map(), changes, removals);
65941
+ }, (event)=>{
65942
+ if ('change' === event.kind) {
65943
+ const mtime = Date.now();
65944
+ callbackUndelayed(event.path, mtime);
65945
+ this.#events.emit('change', event.path, mtime);
65946
+ watcher.emit('change', event.path, mtime);
65947
+ } else {
65948
+ this.#events.emit('remove', event.path);
65949
+ watcher.emit('remove', event.path);
65950
+ }
65917
65951
  });
65918
65952
  this.#isFirstWatch = false;
65919
65953
  return {
@@ -65952,6 +65986,26 @@ class NativeWatchFileSystem {
65952
65986
  triggerEvent(kind, path) {
65953
65987
  this.#inner?.triggerEvent(kind, path);
65954
65988
  }
65989
+ on(event, listener) {
65990
+ this.#events.on(event, listener);
65991
+ return this;
65992
+ }
65993
+ once(event, listener) {
65994
+ this.#events.once(event, listener);
65995
+ return this;
65996
+ }
65997
+ emit(event, arg1, arg2) {
65998
+ if ('aggregated' === event) {
65999
+ const changes = arg1;
66000
+ const removals = arg2;
66001
+ const notified = this.#events.emit('aggregated', changes, removals);
66002
+ const shimNotified = this.#watcher?.emit('aggregated', changes, removals) ?? false;
66003
+ return notified || shimNotified;
66004
+ }
66005
+ if (!this.#inner) return false;
66006
+ this.#inner.triggerEvent(event, arg1);
66007
+ return true;
66008
+ }
65955
66009
  formatWatchDependencies(dependencies) {
65956
66010
  if (this.#isFirstWatch) return [
65957
66011
  Array.from(dependencies),
@@ -65967,6 +66021,7 @@ class NodeWatchFileSystem {
65967
66021
  inputFileSystem;
65968
66022
  watcherOptions;
65969
66023
  watcher;
66024
+ #events = new events_0.EventEmitter();
65970
66025
  constructor(inputFileSystem){
65971
66026
  this.inputFileSystem = inputFileSystem;
65972
66027
  this.watcherOptions = {
@@ -65985,6 +66040,15 @@ class NodeWatchFileSystem {
65985
66040
  const Watchpack = __webpack_require__(71823);
65986
66041
  this.watcher = new Watchpack(options);
65987
66042
  if (callbackUndelayed) this.watcher?.once('change', callbackUndelayed);
66043
+ this.watcher?.on('change', (filename, mtime)=>{
66044
+ this.#events.emit('change', filename, mtime);
66045
+ });
66046
+ this.watcher?.on('remove', (filename)=>{
66047
+ this.#events.emit('remove', filename);
66048
+ });
66049
+ this.watcher?.on('aggregated', (changes, removals)=>{
66050
+ this.#events.emit('aggregated', changes, removals);
66051
+ });
65988
66052
  const fetchTimeInfo = ()=>{
65989
66053
  const fileTimeInfoEntries = new Map();
65990
66054
  const contextTimeInfoEntries = new Map();
@@ -66057,6 +66121,22 @@ class NodeWatchFileSystem {
66057
66121
  }
66058
66122
  };
66059
66123
  }
66124
+ on(event, listener) {
66125
+ this.#events.on(event, listener);
66126
+ return this;
66127
+ }
66128
+ once(event, listener) {
66129
+ this.#events.once(event, listener);
66130
+ return this;
66131
+ }
66132
+ emit(event, arg1, arg2) {
66133
+ if ('aggregated' === event) return this.#events.emit('aggregated', arg1, arg2);
66134
+ if (!this.watcher) return false;
66135
+ const filename = arg1;
66136
+ if ('change' === event) this.watcher._onChange(filename, arg2 ?? Date.now(), filename, 'change');
66137
+ else this.watcher._onRemove(filename, filename, 'rename');
66138
+ return true;
66139
+ }
66060
66140
  }
66061
66141
  const arraySum = (array)=>{
66062
66142
  let sum = 0;
@@ -67023,7 +67103,7 @@ const SIMPLE_EXTRACTORS = {
67023
67103
  },
67024
67104
  version: (object)=>{
67025
67105
  object.version = "5.75.0";
67026
- object.rspackVersion = "2.1.0-rc.0";
67106
+ object.rspackVersion = "2.1.1";
67027
67107
  },
67028
67108
  env: (object, _compilation, _context, { _env })=>{
67029
67109
  object.env = _env;
@@ -68920,7 +69000,7 @@ const createHtmlPluginHooksRegisters = (getCompiler, createTap)=>{
68920
69000
  })
68921
69001
  };
68922
69002
  };
68923
- var compilation_Buffer = __webpack_require__(71015).h;
69003
+ var compilation_Buffer = __webpack_require__(98041).h;
68924
69004
  class CodeGenerationResult {
68925
69005
  #inner;
68926
69006
  constructor(result){
@@ -69397,7 +69477,7 @@ const createContextModuleFactoryHooksRegisters = (getCompiler, createTap)=>({
69397
69477
  };
69398
69478
  })
69399
69479
  });
69400
- var javascriptModules_Buffer = __webpack_require__(71015).h;
69480
+ var javascriptModules_Buffer = __webpack_require__(98041).h;
69401
69481
  const createJavaScriptModulesHooksRegisters = (getCompiler, createTap)=>({
69402
69482
  registerJavascriptModulesChunkHashTaps: createTap(rspack_wasi_browser.RegisterJsTapKind.JavascriptModulesChunkHash, function() {
69403
69483
  return JavascriptModulesPlugin.getCompilationHooks(getCompiler().__internal__get_compilation()).chunkHash;
@@ -70312,7 +70392,7 @@ class Compiler {
70312
70392
  this.#rawOptions = getRawOptions(options, this);
70313
70393
  this.#rawOptions.__references = Object.fromEntries(this.#ruleSet.builtinReferences.entries());
70314
70394
  this.#rawOptions.__virtual_files = VirtualModulesPlugin.__internal__take_virtual_files(this);
70315
- const instanceBinding = __webpack_require__(88552);
70395
+ const instanceBinding = __webpack_require__(30977);
70316
70396
  this.#registers = this.#createHooksRegisters();
70317
70397
  const inputFileSystem = this.inputFileSystem && ThreadsafeInputNodeFS.needsBinding(options.experiments.useInputFileSystem) ? ThreadsafeInputNodeFS.__to_binding(this.inputFileSystem) : void 0;
70318
70398
  try {
@@ -71983,7 +72063,7 @@ function transformSync(source, options) {
71983
72063
  const _options = JSON.stringify(options || {});
71984
72064
  return rspack_wasi_browser.transformSync(source, _options);
71985
72065
  }
71986
- const exports_rspackVersion = "2.1.0-rc.0";
72066
+ const exports_rspackVersion = "2.1.1";
71987
72067
  const exports_version = "5.75.0";
71988
72068
  const exports_WebpackError = Error;
71989
72069
  const exports_config = {
@@ -72082,7 +72162,7 @@ const exports_experiments = {
72082
72162
  const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
72083
72163
  src_fn.rspack = src_fn;
72084
72164
  src_fn.webpack = src_fn;
72085
- const src_rspack_0 = src_fn;
72165
+ const src_rspack = src_fn;
72086
72166
  class BrowserHttpImportEsmPlugin {
72087
72167
  options;
72088
72168
  constructor(options){
@@ -72252,4 +72332,4 @@ const builtinMemFs = {
72252
72332
  volume: fs_0.volume,
72253
72333
  memfs: fs_0.memfs
72254
72334
  };
72255
- export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularCheckRspackPlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, ModuleGraphConnection_ModuleGraphConnection as ModuleGraphConnection, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, ids, javascript, lazyCompilationMiddleware, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webpack_sources_lib as sources, webworker };
72335
+ export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularCheckRspackPlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, ModuleGraphConnection_ModuleGraphConnection as ModuleGraphConnection, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, ids, javascript, lazyCompilationMiddleware, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack as "module.exports", src_rspack as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webpack_sources_lib as sources, webworker };
@@ -19,7 +19,6 @@ export declare class HookWebpackError extends WebpackError {
19
19
  */
20
20
  constructor(error: Error, hook: string);
21
21
  }
22
- export default HookWebpackError;
23
22
  /**
24
23
  * @param error an error
25
24
  * @param hook name of the hook
@@ -32,4 +32,4 @@ declare class LazyHashedEtag {
32
32
  * @returns etag
33
33
  */
34
34
  export declare const getter: (obj: HashableObject, hashFunction?: string | HashConstructor) => LazyHashedEtag;
35
- export default getter;
35
+ export {};
@@ -14,4 +14,3 @@ import type { Etag } from '../Cache';
14
14
  * @returns result
15
15
  */
16
16
  export declare const mergeEtags: (first: Etag, second: Etag) => Etag;
17
- export default mergeEtags;
@@ -464,7 +464,7 @@ export declare class ModuleGraphConnection {
464
464
 
465
465
  export declare class NativeWatcher {
466
466
  constructor(options: NativeWatcherOptions)
467
- watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (path: string) => void): void
467
+ watch(files: [Array<string>, Array<string>], directories: [Array<string>, Array<string>], missing: [Array<string>, Array<string>], startTime: bigint, callback: (err: Error | null, result: NativeWatchResult) => void, callbackUndelayed: (event: NativeWatchUndelayedEvent) => void): void
468
468
  triggerEvent(kind: 'change' | 'remove' | 'create', path: string): void
469
469
  /**
470
470
  * # Safety
@@ -1189,7 +1189,7 @@ export interface JsRsdoctorModuleGraph {
1189
1189
  dependencies: Array<JsRsdoctorDependency>
1190
1190
  chunkModules: Array<JsRsdoctorChunkModules>
1191
1191
  connectionsOnlyImports: Array<JsRsdoctorConnectionsOnlyImport>
1192
- exportUsageEdges: Array<[number, Array<string> | null, number, Array<string> | null]>
1192
+ exportUsageEdges: Array<[number, Array<string> | null, number, Array<string> | null, string, string | null]>
1193
1193
  }
1194
1194
 
1195
1195
  export interface JsRsdoctorModuleGraphModule {
@@ -1797,6 +1797,16 @@ export interface NativeWatcherOptions {
1797
1797
  ignored?: string | string[] | RegExp
1798
1798
  }
1799
1799
 
1800
+ /**
1801
+ * A single, undelayed file system event delivered to the `callbackUndelayed`
1802
+ * callback. Passed as one object so napi-rs delivers it as a single JS
1803
+ * argument unambiguously (a tuple would arrive as an array).
1804
+ */
1805
+ export interface NativeWatchUndelayedEvent {
1806
+ kind: string
1807
+ path: string
1808
+ }
1809
+
1800
1810
  export interface NodeFsStats {
1801
1811
  isFile: boolean
1802
1812
  isDirectory: boolean
@@ -1916,6 +1926,8 @@ export interface RawCacheOptionsMemory {
1916
1926
  export interface RawCacheOptionsPersistent {
1917
1927
  buildDependencies?: Array<string>
1918
1928
  version?: string
1929
+ maxAge: number
1930
+ maxVersions: number
1919
1931
  snapshot?: RawSnapshotOptions
1920
1932
  storage?: RawStorageOptions
1921
1933
  portable?: boolean
@@ -3086,8 +3098,6 @@ export interface RawStatsOptions {
3086
3098
  export interface RawStorageOptions {
3087
3099
  type: "filesystem"
3088
3100
  directory: string
3089
- maxAge: number
3090
- maxGenerations: number
3091
3101
  }
3092
3102
 
3093
3103
  export interface RawSubresourceIntegrityPluginOptions {
@@ -11,10 +11,20 @@ import type Watchpack from 'watchpack';
11
11
  import type { FileSystemInfoEntry, InputFileSystem, Watcher, WatchFileSystem } from '../util/fs';
12
12
  type WatchpackInstance = InstanceType<typeof Watchpack>;
13
13
  export default class NodeWatchFileSystem implements WatchFileSystem {
14
+ #private;
14
15
  inputFileSystem: InputFileSystem;
15
16
  watcherOptions: Watchpack.WatchOptions;
16
17
  watcher?: WatchpackInstance;
17
18
  constructor(inputFileSystem: InputFileSystem);
18
19
  watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
20
+ on(event: 'change', listener: (filename: string, mtime: number) => void): this;
21
+ on(event: 'remove', listener: (filename: string) => void): this;
22
+ on(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
23
+ once(event: 'change', listener: (filename: string, mtime: number) => void): this;
24
+ once(event: 'remove', listener: (filename: string) => void): this;
25
+ once(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
26
+ emit(event: 'change', filename: string, mtime: number): boolean;
27
+ emit(event: 'remove', filename: string): boolean;
28
+ emit(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
19
29
  }
20
30
  export {};
package/dist/rspack.d.ts CHANGED
@@ -22,4 +22,3 @@ declare function rspack(options: MultiRspackOptions, callback?: Callback<Error,
22
22
  declare function rspack(options: RspackOptions, callback?: Callback<Error, Stats>): null | Compiler;
23
23
  declare function rspack(options: MultiRspackOptions | RspackOptions, callback?: Callback<Error, MultiStats | Stats>): null | MultiCompiler | Compiler;
24
24
  export { createCompiler, createMultiCompiler, MultiStats, rspack, Stats };
25
- export default rspack;
Binary file
@@ -2,7 +2,6 @@ import type { Compiler } from '../Compiler';
2
2
  import type { LibraryOptions, Plugins } from '../config';
3
3
  import { type ModuleFederationManifestPluginOptions } from '../container/ModuleFederationManifestPlugin';
4
4
  import type { Shared, SharedConfig } from './SharePlugin';
5
- export type MakeRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
6
5
  export interface IndependentSharePluginOptions {
7
6
  name: string;
8
7
  shared: Shared;
@@ -126,11 +126,6 @@ export type KnownStatsModule = {
126
126
  filteredModules?: number;
127
127
  source?: string | Buffer;
128
128
  };
129
- export type KnownStatsProfile = {
130
- total: number;
131
- resolving: number;
132
- building: number;
133
- };
134
129
  export type StatsModule = KnownStatsModule & Record<string, any>;
135
130
  export type KnownStatsModuleIssuer = {
136
131
  identifier?: string;
@@ -334,5 +329,4 @@ export declare const errorsSpaceLimit: (errors: StatsError[], max: number) => {
334
329
  errors: StatsError[];
335
330
  filtered: number;
336
331
  };
337
- export declare const warningFromStatsWarning: (warning: binding.JsStatsError) => Error;
338
332
  export {};
@@ -11,6 +11,6 @@ export type Comparator = <T>(arg0: T, arg1: T) => -1 | 0 | 1;
11
11
  type Selector<A, B> = (input: A) => B;
12
12
  export declare const concatComparators: (...comps: Comparator[]) => Comparator;
13
13
  export declare const compareIds: <T = string | number>(a: T, b: T) => -1 | 0 | 1;
14
- export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
15
14
  export declare const compareNumbers: (a: number, b: number) => -1 | 0 | 1;
15
+ export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
16
16
  export {};
@@ -1,6 +1,3 @@
1
- export type FakeHook<T> = T & {
2
- _fakeHook: true;
3
- };
4
1
  export declare function createFakeCompilationDependencies(getDeps: () => string[], addDeps: (deps: string[]) => void): {
5
2
  [Symbol.iterator](): Generator<string, void, unknown>;
6
3
  has: (dep: string) => boolean;
package/dist/util/fs.d.ts CHANGED
@@ -113,7 +113,6 @@ export type JsonObject = {
113
113
  } & {
114
114
  [Key in string]?: JsonValue | undefined;
115
115
  };
116
- export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
117
116
  export type StringCallback = (err: NodeJS.ErrnoException | null, data?: string) => void;
118
117
  export type BufferCallback = (err: NodeJS.ErrnoException | null, data?: Buffer) => void;
119
118
  export type StringOrBufferCallback = (err: NodeJS.ErrnoException | null, data?: string | Buffer) => void;
@@ -124,7 +123,6 @@ export type ReaddirDirentCallback = (err: NodeJS.ErrnoException | null, files?:
124
123
  export type StatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats) => void;
125
124
  export type BigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IBigIntStats) => void;
126
125
  export type StatsOrBigIntStatsCallback = (err: NodeJS.ErrnoException | null, stats?: IStats | IBigIntStats) => void;
127
- export type NumberCallback = (err: NodeJS.ErrnoException | null, data?: number) => void;
128
126
  export type ReadJsonCallback = (err: NodeJS.ErrnoException | Error | null, data?: JsonObject) => void;
129
127
  export type PathLike = string | Buffer | URL;
130
128
  export type PathOrFileDescriptor = PathLike | number;
@@ -320,12 +318,6 @@ export type InputFileSystem = {
320
318
  dirname?: (path: string) => string;
321
319
  };
322
320
  export type IntermediateFileSystem = InputFileSystem & OutputFileSystem & IntermediateFileSystemExtras;
323
- export type WriteStreamOptions = {
324
- flags?: string;
325
- encoding?: 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'utf-16le' | 'ucs2' | 'ucs-2' | 'latin1' | 'binary' | 'base64' | 'base64url' | 'hex';
326
- fd?: any;
327
- mode?: number;
328
- };
329
321
  export type MakeDirectoryOptions = {
330
322
  recursive?: boolean;
331
323
  mode?: string | number;
@@ -371,5 +363,14 @@ export interface WatchFileSystem {
371
363
  added?: Iterable<String>;
372
364
  removed?: Iterable<String>;
373
365
  }, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | 'ignore'>, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
366
+ on?(event: 'change', listener: (filename: string, mtime: number) => void): this;
367
+ on?(event: 'remove', listener: (filename: string) => void): this;
368
+ on?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
369
+ once?(event: 'change', listener: (filename: string, mtime: number) => void): this;
370
+ once?(event: 'remove', listener: (filename: string) => void): this;
371
+ once?(event: 'aggregated', listener: (changes: Set<string>, removals: Set<string>) => void): this;
372
+ emit?(event: 'change', filename: string, mtime: number): boolean;
373
+ emit?(event: 'remove', filename: string): boolean;
374
+ emit?(event: 'aggregated', changes: Set<string>, removals: Set<string>): boolean;
374
375
  }
375
376
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/browser",
3
- "version": "2.1.0-rc.0",
3
+ "version": "2.1.1",
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.",