@rspack-debug/browser 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -32022,18 +32022,18 @@ __webpack_require__.add({
32022
32022
  return copy;
32023
32023
  };
32024
32024
  },
32025
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/DirectoryWatcher.js" (module, __unused_rspack_exports, __webpack_require__) {
32025
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/DirectoryWatcher.js" (module, __unused_rspack_exports, __webpack_require__) {
32026
32026
  var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
32027
- const EventEmitter = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js").EventEmitter;
32028
- const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
32027
+ const { EventEmitter } = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js");
32029
32028
  const path = __webpack_require__("../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js");
32030
- const watchEventSource = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/watchEventSource.js");
32029
+ const fs = __webpack_require__("../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js");
32030
+ const watchEventSource = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/watchEventSource.js");
32031
32031
  const EXISTANCE_ONLY_TIME_ENTRY = Object.freeze({});
32032
32032
  let FS_ACCURACY = 2000;
32033
32033
  const IS_OSX = "darwin" === __webpack_require__("../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js").iD();
32034
32034
  const IS_WIN = "win32" === __webpack_require__("../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js").iD();
32035
- const WATCHPACK_POLLING = process.env.WATCHPACK_POLLING;
32036
- const FORCE_POLLING = `${+WATCHPACK_POLLING}` === WATCHPACK_POLLING ? +WATCHPACK_POLLING : !!WATCHPACK_POLLING && "false" !== WATCHPACK_POLLING;
32035
+ const { WATCHPACK_POLLING } = process.env;
32036
+ const FORCE_POLLING = `${+WATCHPACK_POLLING}` === WATCHPACK_POLLING ? +WATCHPACK_POLLING : Boolean(WATCHPACK_POLLING) && "false" !== WATCHPACK_POLLING;
32037
32037
  function withoutCase(str) {
32038
32038
  return str.toLowerCase();
32039
32039
  }
@@ -32042,15 +32042,28 @@ __webpack_require__.add({
32042
32042
  if (0 === --times) return callback();
32043
32043
  };
32044
32044
  }
32045
+ function fixupEntryAccuracy(entry) {
32046
+ if (entry.accuracy > FS_ACCURACY) {
32047
+ entry.safeTime = entry.safeTime - entry.accuracy + FS_ACCURACY;
32048
+ entry.accuracy = FS_ACCURACY;
32049
+ }
32050
+ }
32051
+ function ensureFsAccuracy(mtime) {
32052
+ if (!mtime) return;
32053
+ if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1;
32054
+ else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10;
32055
+ else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100;
32056
+ else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000;
32057
+ }
32045
32058
  class Watcher extends EventEmitter {
32046
- constructor(directoryWatcher, filePath, startTime){
32059
+ constructor(directoryWatcher, target, startTime){
32047
32060
  super();
32048
32061
  this.directoryWatcher = directoryWatcher;
32049
- this.path = filePath;
32062
+ this.path = target;
32050
32063
  this.startTime = startTime && +startTime;
32051
32064
  }
32052
32065
  checkStartTime(mtime, initial) {
32053
- const startTime = this.startTime;
32066
+ const { startTime } = this;
32054
32067
  if ("number" != typeof startTime) return !initial;
32055
32068
  return startTime <= mtime;
32056
32069
  }
@@ -32059,7 +32072,7 @@ __webpack_require__.add({
32059
32072
  }
32060
32073
  }
32061
32074
  class DirectoryWatcher extends EventEmitter {
32062
- constructor(watcherManager, directoryPath, options){
32075
+ constructor(watcherManager, directoryPath, options = {}){
32063
32076
  super();
32064
32077
  if (FORCE_POLLING) options.poll = FORCE_POLLING;
32065
32078
  this.watcherManager = watcherManager;
@@ -32132,11 +32145,12 @@ __webpack_require__.add({
32132
32145
  if (!initial) this.forEachWatcher(this.path, (w)=>w.emit("change", itemPath, null, type, initial));
32133
32146
  }
32134
32147
  }
32135
- setFileTime(filePath, mtime, initial, ignoreWhenEqual, type) {
32148
+ setFileTime(target, mtime, initial, ignoreWhenEqual, type) {
32136
32149
  const now = Date.now();
32137
- if (this.ignored(filePath)) return;
32138
- const old = this.files.get(filePath);
32139
- let safeTime, accuracy;
32150
+ if (this.ignored(target)) return;
32151
+ const old = this.files.get(target);
32152
+ let safeTime;
32153
+ let accuracy;
32140
32154
  if (initial) {
32141
32155
  safeTime = Math.min(now, mtime) + FS_ACCURACY;
32142
32156
  accuracy = FS_ACCURACY;
@@ -32146,24 +32160,24 @@ __webpack_require__.add({
32146
32160
  if (old && old.timestamp === mtime && mtime + FS_ACCURACY < now) return;
32147
32161
  }
32148
32162
  if (ignoreWhenEqual && old && old.timestamp === mtime) return;
32149
- this.files.set(filePath, {
32163
+ this.files.set(target, {
32150
32164
  safeTime,
32151
32165
  accuracy,
32152
32166
  timestamp: mtime
32153
32167
  });
32154
32168
  if (old) {
32155
- if (!initial) this.forEachWatcher(filePath, (w)=>w.emit("change", mtime, type));
32169
+ if (!initial) this.forEachWatcher(target, (w)=>w.emit("change", mtime, type));
32156
32170
  } else {
32157
- const key = withoutCase(filePath);
32171
+ const key = withoutCase(target);
32158
32172
  const count = this.filesWithoutCase.get(key);
32159
32173
  this.filesWithoutCase.set(key, (count || 0) + 1);
32160
32174
  if (void 0 !== count) this.doScan(false);
32161
- this.forEachWatcher(filePath, (w)=>{
32175
+ this.forEachWatcher(target, (w)=>{
32162
32176
  if (!initial || w.checkStartTime(safeTime, initial)) w.emit("change", mtime, type);
32163
32177
  });
32164
32178
  }
32165
32179
  this.forEachWatcher(this.path, (w)=>{
32166
- if (!initial || w.checkStartTime(safeTime, initial)) w.emit("change", filePath, safeTime, type, initial);
32180
+ if (!initial || w.checkStartTime(safeTime, initial)) w.emit("change", target, safeTime, type, initial);
32167
32181
  });
32168
32182
  }
32169
32183
  setDirectory(directoryPath, birthtime, initial, type) {
@@ -32176,8 +32190,7 @@ __webpack_require__.add({
32176
32190
  const now = Date.now();
32177
32191
  if (this.nestedWatching) this.createNestedWatcher(directoryPath);
32178
32192
  else this.directories.set(directoryPath, true);
32179
- let safeTime;
32180
- safeTime = initial ? Math.min(now, birthtime) + FS_ACCURACY : now;
32193
+ const safeTime = initial ? Math.min(now, birthtime) + FS_ACCURACY : now;
32181
32194
  this.forEachWatcher(directoryPath, (w)=>{
32182
32195
  if (!initial || w.checkStartTime(safeTime, false)) w.emit("change", birthtime, type);
32183
32196
  });
@@ -32189,16 +32202,16 @@ __webpack_require__.add({
32189
32202
  }
32190
32203
  createNestedWatcher(directoryPath) {
32191
32204
  const watcher = this.watcherManager.watchDirectory(directoryPath, 1);
32192
- watcher.on("change", (filePath, mtime, type, initial)=>{
32205
+ watcher.on("change", (target, mtime, type, initial)=>{
32193
32206
  this.forEachWatcher(this.path, (w)=>{
32194
- if (!initial || w.checkStartTime(mtime, initial)) w.emit("change", filePath, mtime, type, initial);
32207
+ if (!initial || w.checkStartTime(mtime, initial)) w.emit("change", target, mtime, type, initial);
32195
32208
  });
32196
32209
  });
32197
32210
  this.directories.set(directoryPath, watcher);
32198
32211
  }
32199
32212
  setNestedWatching(flag) {
32200
- if (!!flag !== this.nestedWatching) {
32201
- this.nestedWatching = !!flag;
32213
+ if (this.nestedWatching !== Boolean(flag)) {
32214
+ this.nestedWatching = Boolean(flag);
32202
32215
  if (this.nestedWatching) for (const directory of this.directories.keys())this.createNestedWatcher(directory);
32203
32216
  else for (const [directory, watcher] of this.directories){
32204
32217
  watcher.close();
@@ -32206,26 +32219,26 @@ __webpack_require__.add({
32206
32219
  }
32207
32220
  }
32208
32221
  }
32209
- watch(filePath, startTime) {
32210
- const key = withoutCase(filePath);
32222
+ watch(target, startTime) {
32223
+ const key = withoutCase(target);
32211
32224
  let watchers = this.watchers.get(key);
32212
32225
  if (void 0 === watchers) {
32213
32226
  watchers = new Set();
32214
32227
  this.watchers.set(key, watchers);
32215
32228
  }
32216
32229
  this.refs++;
32217
- const watcher = new Watcher(this, filePath, startTime);
32230
+ const watcher = new Watcher(this, target, startTime);
32218
32231
  watcher.on("closed", ()=>{
32219
32232
  if (--this.refs <= 0) return void this.close();
32220
32233
  watchers.delete(watcher);
32221
32234
  if (0 === watchers.size) {
32222
32235
  this.watchers.delete(key);
32223
- if (this.path === filePath) this.setNestedWatching(false);
32236
+ if (this.path === target) this.setNestedWatching(false);
32224
32237
  }
32225
32238
  });
32226
32239
  watchers.add(watcher);
32227
32240
  let safeTime;
32228
- if (filePath === this.path) {
32241
+ if (target === this.path) {
32229
32242
  this.setNestedWatching(true);
32230
32243
  safeTime = this.lastWatchEvent;
32231
32244
  for (const entry of this.files.values()){
@@ -32233,24 +32246,24 @@ __webpack_require__.add({
32233
32246
  safeTime = Math.max(safeTime, entry.safeTime);
32234
32247
  }
32235
32248
  } else {
32236
- const entry = this.files.get(filePath);
32249
+ const entry = this.files.get(target);
32237
32250
  if (entry) {
32238
32251
  fixupEntryAccuracy(entry);
32239
32252
  safeTime = entry.safeTime;
32240
32253
  } else safeTime = 0;
32241
32254
  }
32242
32255
  if (safeTime) {
32243
- if (safeTime >= startTime) process.nextTick(()=>{
32256
+ if (startTime && safeTime >= startTime) process.nextTick(()=>{
32244
32257
  if (this.closed) return;
32245
- if (filePath === this.path) watcher.emit("change", filePath, safeTime, "watch (outdated on attach)", true);
32258
+ if (target === this.path) watcher.emit("change", target, safeTime, "watch (outdated on attach)", true);
32246
32259
  else watcher.emit("change", safeTime, "watch (outdated on attach)", true);
32247
32260
  });
32248
32261
  } else if (this.initialScan) {
32249
- if (this.initialScanRemoved.has(filePath)) process.nextTick(()=>{
32262
+ if (this.initialScanRemoved.has(target)) process.nextTick(()=>{
32250
32263
  if (this.closed) return;
32251
32264
  watcher.emit("remove");
32252
32265
  });
32253
- } else if (filePath !== this.path && !this.directories.has(filePath) && watcher.checkStartTime(this.initialScanFinished, false)) process.nextTick(()=>{
32266
+ } else if (target !== this.path && !this.directories.has(target) && watcher.checkStartTime(this.initialScanFinished, false)) process.nextTick(()=>{
32254
32267
  if (this.closed) return;
32255
32268
  watcher.emit("initial-missing", "watch (missing on attach)");
32256
32269
  });
@@ -32259,31 +32272,29 @@ __webpack_require__.add({
32259
32272
  onWatchEvent(eventType, filename) {
32260
32273
  if (this.closed) return;
32261
32274
  if (!filename) return void this.doScan(false);
32262
- const filePath = path.join(this.path, filename);
32263
- if (this.ignored(filePath)) return;
32275
+ const target = path.join(this.path, filename);
32276
+ if (this.ignored(target)) return;
32264
32277
  if (void 0 === this._activeEvents.get(filename)) {
32265
32278
  this._activeEvents.set(filename, false);
32266
32279
  const checkStats = ()=>{
32267
32280
  if (this.closed) return;
32268
32281
  this._activeEvents.set(filename, false);
32269
- fs.lstat(filePath, (err, stats)=>{
32282
+ fs.lstat(target, (err, stats)=>{
32270
32283
  if (this.closed) return;
32271
32284
  if (true === this._activeEvents.get(filename)) return void process.nextTick(checkStats);
32272
32285
  this._activeEvents.delete(filename);
32273
32286
  if (err) {
32274
32287
  if ("ENOENT" !== err.code && "EPERM" !== err.code && "EBUSY" !== err.code) this.onStatsError(err);
32275
- else if (filename === path.basename(this.path)) {
32276
- if (!fs.existsSync(this.path)) this.onDirectoryRemoved("stat failed");
32277
- }
32288
+ else if (filename === path.basename(this.path) && !fs.existsSync(this.path)) this.onDirectoryRemoved("stat failed");
32278
32289
  }
32279
32290
  this.lastWatchEvent = Date.now();
32280
32291
  if (stats) {
32281
- if (stats.isDirectory()) this.setDirectory(filePath, +stats.birthtime || 1, false, eventType);
32292
+ if (stats.isDirectory()) this.setDirectory(target, +stats.birthtime || 1, false, eventType);
32282
32293
  else if (stats.isFile() || stats.isSymbolicLink()) {
32283
- if (stats.mtime) ensureFsAccuracy(stats.mtime);
32284
- this.setFileTime(filePath, +stats.mtime || +stats.ctime || 1, false, false, eventType);
32294
+ if (stats.mtime) ensureFsAccuracy(+stats.mtime);
32295
+ this.setFileTime(target, +stats.mtime || +stats.ctime || 1, false, false, eventType);
32285
32296
  }
32286
- } else this.setMissing(filePath, false, eventType);
32297
+ } else this.setMissing(target, false, eventType);
32287
32298
  });
32288
32299
  };
32289
32300
  process.nextTick(checkStats);
@@ -32292,15 +32303,15 @@ __webpack_require__.add({
32292
32303
  onWatcherError(err) {
32293
32304
  if (this.closed) return;
32294
32305
  if (err) {
32295
- if ("EPERM" !== err.code && "ENOENT" !== err.code) console.error("Watchpack Error (watcher): " + err);
32306
+ if ("EPERM" !== err.code && "ENOENT" !== err.code) console.error(`Watchpack Error (watcher): ${err}`);
32296
32307
  this.onDirectoryRemoved("watch error");
32297
32308
  }
32298
32309
  }
32299
32310
  onStatsError(err) {
32300
- if (err) console.error("Watchpack Error (stats): " + err);
32311
+ if (err) console.error(`Watchpack Error (stats): ${err}`);
32301
32312
  }
32302
32313
  onScanError(err) {
32303
- if (err) console.error("Watchpack Error (initial scan): " + err);
32314
+ if (err) console.error(`Watchpack Error (initial scan): ${err}`);
32304
32315
  this.onScanFinished();
32305
32316
  }
32306
32317
  onScanFinished() {
@@ -32316,8 +32327,8 @@ __webpack_require__.add({
32316
32327
  }
32317
32328
  this.watchInParentDirectory();
32318
32329
  const type = `directory-removed (${reason})`;
32319
- for (const directory of this.directories.keys())this.setMissing(directory, null, type);
32320
- for (const file of this.files.keys())this.setMissing(file, null, type);
32330
+ for (const directory of this.directories.keys())this.setMissing(directory, false, type);
32331
+ for (const file of this.files.keys())this.setMissing(file, false, type);
32321
32332
  }
32322
32333
  watchInParentDirectory() {
32323
32334
  if (!this.parentWatcher) {
@@ -32404,17 +32415,15 @@ __webpack_require__.add({
32404
32415
  for (const itemPath of itemPaths)fs.lstat(itemPath, (err2, stats)=>{
32405
32416
  if (this.closed) return;
32406
32417
  if (err2) {
32407
- if ("ENOENT" === err2.code || "EPERM" === err2.code || "EACCES" === err2.code || "EBUSY" === err2.code || "EINVAL" === err2.code && IS_WIN) this.setMissing(itemPath, initial, "scan (" + err2.code + ")");
32418
+ if ("ENOENT" === err2.code || "EPERM" === err2.code || "EACCES" === err2.code || "EBUSY" === err2.code || "EINVAL" === err2.code && IS_WIN) this.setMissing(itemPath, initial, `scan (${err2.code})`);
32408
32419
  else this.onScanError(err2);
32409
32420
  itemFinished();
32410
32421
  return;
32411
32422
  }
32412
32423
  if (stats.isFile() || stats.isSymbolicLink()) {
32413
- if (stats.mtime) ensureFsAccuracy(stats.mtime);
32424
+ if (stats.mtime) ensureFsAccuracy(+stats.mtime);
32414
32425
  this.setFileTime(itemPath, +stats.mtime || +stats.ctime || 1, initial, true, "scan (file)");
32415
- } else if (stats.isDirectory()) {
32416
- if (!initial || !this.directories.has(itemPath)) this.setDirectory(itemPath, +stats.birthtime || 1, initial, "scan (dir)");
32417
- }
32426
+ } else if (stats.isDirectory() && (!initial || !this.directories.has(itemPath))) this.setDirectory(itemPath, +stats.birthtime || 1, initial, "scan (dir)");
32418
32427
  itemFinished();
32419
32428
  });
32420
32429
  itemFinished();
@@ -32441,7 +32450,7 @@ __webpack_require__.add({
32441
32450
  obj[this.path] = safeTime;
32442
32451
  }
32443
32452
  if (!this.initialScan) for (const watchers of this.watchers.values())for (const watcher of watchers){
32444
- const path = watcher.path;
32453
+ const { path } = watcher;
32445
32454
  if (!Object.prototype.hasOwnProperty.call(obj, path)) obj[path] = null;
32446
32455
  }
32447
32456
  return obj;
@@ -32468,7 +32477,7 @@ __webpack_require__.add({
32468
32477
  directoryTimestamps.set(this.path, EXISTANCE_ONLY_TIME_ENTRY);
32469
32478
  }
32470
32479
  if (!this.initialScan) for (const watchers of this.watchers.values())for (const watcher of watchers){
32471
- const path = watcher.path;
32480
+ const { path } = watcher;
32472
32481
  if (!fileTimestamps.has(path)) fileTimestamps.set(path, null);
32473
32482
  }
32474
32483
  return safeTime;
@@ -32493,21 +32502,9 @@ __webpack_require__.add({
32493
32502
  }
32494
32503
  module.exports = DirectoryWatcher;
32495
32504
  module.exports.EXISTANCE_ONLY_TIME_ENTRY = EXISTANCE_ONLY_TIME_ENTRY;
32496
- function fixupEntryAccuracy(entry) {
32497
- if (entry.accuracy > FS_ACCURACY) {
32498
- entry.safeTime = entry.safeTime - entry.accuracy + FS_ACCURACY;
32499
- entry.accuracy = FS_ACCURACY;
32500
- }
32501
- }
32502
- function ensureFsAccuracy(mtime) {
32503
- if (!mtime) return;
32504
- if (FS_ACCURACY > 1 && mtime % 1 !== 0) FS_ACCURACY = 1;
32505
- else if (FS_ACCURACY > 10 && mtime % 10 !== 0) FS_ACCURACY = 10;
32506
- else if (FS_ACCURACY > 100 && mtime % 100 !== 0) FS_ACCURACY = 100;
32507
- else if (FS_ACCURACY > 1000 && mtime % 1000 !== 0) FS_ACCURACY = 1000;
32508
- }
32505
+ module.exports.Watcher = Watcher;
32509
32506
  },
32510
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/LinkResolver.js" (module, __unused_rspack_exports, __webpack_require__) {
32507
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/LinkResolver.js" (module, __unused_rspack_exports, __webpack_require__) {
32511
32508
  var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
32512
32509
  const fs = __webpack_require__("./src/browser/fs.ts");
32513
32510
  const path = __webpack_require__("../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js");
@@ -32546,14 +32543,20 @@ __webpack_require__.add({
32546
32543
  const resultSet = new Set(linkResolved);
32547
32544
  resultSet.add(realFile);
32548
32545
  for(let i = 1; i < parentResolved.length; i++)resultSet.add(parentResolved[i]);
32549
- result = Object.freeze(Array.from(resultSet));
32546
+ result = Object.freeze([
32547
+ ...resultSet
32548
+ ]);
32550
32549
  } else if (parentResolved.length > 1) {
32551
- result = parentResolved.slice();
32550
+ result = [
32551
+ ...parentResolved
32552
+ ];
32552
32553
  result[0] = linkResolved[0];
32553
32554
  result.push(realFile);
32554
32555
  Object.freeze(result);
32555
32556
  } else if (linkResolved.length > 1) {
32556
- result = linkResolved.slice();
32557
+ result = [
32558
+ ...linkResolved
32559
+ ];
32557
32560
  result.push(realFile);
32558
32561
  Object.freeze(result);
32559
32562
  } else result = Object.freeze([
@@ -32562,9 +32565,11 @@ __webpack_require__.add({
32562
32565
  ]);
32563
32566
  this.cache.set(file, result);
32564
32567
  return result;
32565
- } catch (e) {
32566
- if (!EXPECTED_ERRORS.has(e.code)) throw e;
32567
- const result = parentResolved.slice();
32568
+ } catch (err) {
32569
+ if (err.code && !EXPECTED_ERRORS.has(err.code)) throw err;
32570
+ const result = [
32571
+ ...parentResolved
32572
+ ];
32568
32573
  result[0] = realFile;
32569
32574
  Object.freeze(result);
32570
32575
  this.cache.set(file, result);
@@ -32574,11 +32579,11 @@ __webpack_require__.add({
32574
32579
  }
32575
32580
  module.exports = LinkResolver;
32576
32581
  },
32577
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/getWatcherManager.js" (module, __unused_rspack_exports, __webpack_require__) {
32582
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/getWatcherManager.js" (module, __unused_rspack_exports, __webpack_require__) {
32578
32583
  const path = __webpack_require__("../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js");
32579
- const DirectoryWatcher = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/DirectoryWatcher.js");
32584
+ const DirectoryWatcher = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/DirectoryWatcher.js");
32580
32585
  class WatcherManager {
32581
- constructor(options){
32586
+ constructor(options = {}){
32582
32587
  this.options = options;
32583
32588
  this.directoryWatchers = new Map();
32584
32589
  }
@@ -32594,10 +32599,10 @@ __webpack_require__.add({
32594
32599
  }
32595
32600
  return watcher;
32596
32601
  }
32597
- watchFile(p, startTime) {
32598
- const directory = path.dirname(p);
32599
- if (directory === p) return null;
32600
- return this.getDirectoryWatcher(directory).watch(p, startTime);
32602
+ watchFile(file, startTime) {
32603
+ const directory = path.dirname(file);
32604
+ if (directory === file) return null;
32605
+ return this.getDirectoryWatcher(directory).watch(file, startTime);
32601
32606
  }
32602
32607
  watchDirectory(directory, startTime) {
32603
32608
  return this.getDirectoryWatcher(directory).watch(directory, startTime);
@@ -32613,12 +32618,300 @@ __webpack_require__.add({
32613
32618
  };
32614
32619
  module.exports.WatcherManager = WatcherManager;
32615
32620
  },
32616
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/reducePlan.js" (module, __unused_rspack_exports, __webpack_require__) {
32621
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/index.js" (module, __unused_rspack_exports, __webpack_require__) {
32622
+ const { EventEmitter } = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js");
32623
+ const globToRegExp = __webpack_require__("../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js");
32624
+ const LinkResolver = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/LinkResolver.js");
32625
+ const getWatcherManager = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/getWatcherManager.js");
32626
+ const watchEventSource = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/watchEventSource.js");
32627
+ function addWatchersToSet(watchers, set) {
32628
+ for (const ww of watchers){
32629
+ const w = ww.watcher;
32630
+ if (!set.has(w.directoryWatcher)) set.add(w.directoryWatcher);
32631
+ }
32632
+ }
32633
+ const stringToRegexp = (ignored)=>{
32634
+ if (0 === ignored.length) return;
32635
+ const { source } = globToRegExp(ignored, {
32636
+ globstar: true,
32637
+ extended: true
32638
+ });
32639
+ return `${source.slice(0, -1)}(?:$|\\/)`;
32640
+ };
32641
+ const ignoredToFunction = (ignored)=>{
32642
+ if (Array.isArray(ignored)) {
32643
+ const stringRegexps = ignored.map((i)=>stringToRegexp(i)).filter(Boolean);
32644
+ if (0 === stringRegexps.length) return ()=>false;
32645
+ const regexp = new RegExp(stringRegexps.join("|"));
32646
+ return (item)=>regexp.test(item.replace(/\\/g, "/"));
32647
+ }
32648
+ if ("string" == typeof ignored) {
32649
+ const stringRegexp = stringToRegexp(ignored);
32650
+ if (!stringRegexp) return ()=>false;
32651
+ const regexp = new RegExp(stringRegexp);
32652
+ return (item)=>regexp.test(item.replace(/\\/g, "/"));
32653
+ }
32654
+ if (ignored instanceof RegExp) return (item)=>ignored.test(item.replace(/\\/g, "/"));
32655
+ if ("function" == typeof ignored) return ignored;
32656
+ if (!ignored) return ()=>false;
32657
+ else throw new Error(`Invalid option for 'ignored': ${ignored}`);
32658
+ };
32659
+ const normalizeOptions = (options)=>({
32660
+ followSymlinks: Boolean(options.followSymlinks),
32661
+ ignored: ignoredToFunction(options.ignored),
32662
+ poll: options.poll
32663
+ });
32664
+ const normalizeCache = new WeakMap();
32665
+ const cachedNormalizeOptions = (options)=>{
32666
+ const cacheEntry = normalizeCache.get(options);
32667
+ if (void 0 !== cacheEntry) return cacheEntry;
32668
+ const normalized = normalizeOptions(options);
32669
+ normalizeCache.set(options, normalized);
32670
+ return normalized;
32671
+ };
32672
+ class WatchpackFileWatcher {
32673
+ constructor(watchpack, watcher, files){
32674
+ this.files = Array.isArray(files) ? files : [
32675
+ files
32676
+ ];
32677
+ this.watcher = watcher;
32678
+ watcher.on("initial-missing", (type)=>{
32679
+ for (const file of this.files)if (!watchpack._missing.has(file)) watchpack._onRemove(file, file, type);
32680
+ });
32681
+ watcher.on("change", (mtime, type, _initial)=>{
32682
+ for (const file of this.files)watchpack._onChange(file, mtime, file, type);
32683
+ });
32684
+ watcher.on("remove", (type)=>{
32685
+ for (const file of this.files)watchpack._onRemove(file, file, type);
32686
+ });
32687
+ }
32688
+ update(files) {
32689
+ if (Array.isArray(files)) this.files = files;
32690
+ else if (1 !== this.files.length) this.files = [
32691
+ files
32692
+ ];
32693
+ else if (this.files[0] !== files) this.files[0] = files;
32694
+ }
32695
+ close() {
32696
+ this.watcher.close();
32697
+ }
32698
+ }
32699
+ class WatchpackDirectoryWatcher {
32700
+ constructor(watchpack, watcher, directories){
32701
+ this.directories = Array.isArray(directories) ? directories : [
32702
+ directories
32703
+ ];
32704
+ this.watcher = watcher;
32705
+ watcher.on("initial-missing", (type)=>{
32706
+ for (const item of this.directories)watchpack._onRemove(item, item, type);
32707
+ });
32708
+ watcher.on("change", (file, mtime, type, _initial)=>{
32709
+ for (const item of this.directories)watchpack._onChange(item, mtime, file, type);
32710
+ });
32711
+ watcher.on("remove", (type)=>{
32712
+ for (const item of this.directories)watchpack._onRemove(item, item, type);
32713
+ });
32714
+ }
32715
+ update(directories) {
32716
+ if (Array.isArray(directories)) this.directories = directories;
32717
+ else if (1 !== this.directories.length) this.directories = [
32718
+ directories
32719
+ ];
32720
+ else if (this.directories[0] !== directories) this.directories[0] = directories;
32721
+ }
32722
+ close() {
32723
+ this.watcher.close();
32724
+ }
32725
+ }
32726
+ class Watchpack extends EventEmitter {
32727
+ constructor(options = {}){
32728
+ super();
32729
+ if (!options) options = {};
32730
+ this.options = options;
32731
+ this.aggregateTimeout = "number" == typeof options.aggregateTimeout ? options.aggregateTimeout : 200;
32732
+ this.watcherOptions = cachedNormalizeOptions(options);
32733
+ this.watcherManager = getWatcherManager(this.watcherOptions);
32734
+ this.fileWatchers = new Map();
32735
+ this.directoryWatchers = new Map();
32736
+ this._missing = new Set();
32737
+ this.startTime = void 0;
32738
+ this.paused = false;
32739
+ this.aggregatedChanges = new Set();
32740
+ this.aggregatedRemovals = new Set();
32741
+ this.aggregateTimer = void 0;
32742
+ this._onTimeout = this._onTimeout.bind(this);
32743
+ }
32744
+ watch(arg1, arg2, arg3) {
32745
+ let files;
32746
+ let directories;
32747
+ let missing;
32748
+ let startTime;
32749
+ if (arg2) {
32750
+ files = arg1;
32751
+ directories = arg2;
32752
+ missing = [];
32753
+ startTime = arg3;
32754
+ } else ({ files = [], directories = [], missing = [], startTime } = arg1);
32755
+ this.paused = false;
32756
+ const { fileWatchers, directoryWatchers } = this;
32757
+ const { ignored } = this.watcherOptions;
32758
+ const filter = (path)=>!ignored(path);
32759
+ const addToMap = (map, key, item)=>{
32760
+ const list = map.get(key);
32761
+ if (void 0 === list) map.set(key, item);
32762
+ else if (Array.isArray(list)) list.push(item);
32763
+ else map.set(key, [
32764
+ list,
32765
+ item
32766
+ ]);
32767
+ };
32768
+ const fileWatchersNeeded = new Map();
32769
+ const directoryWatchersNeeded = new Map();
32770
+ const missingFiles = new Set();
32771
+ if (this.watcherOptions.followSymlinks) {
32772
+ const resolver = new LinkResolver();
32773
+ for (const file of files)if (filter(file)) {
32774
+ for (const innerFile of resolver.resolve(file))if (file === innerFile || filter(innerFile)) addToMap(fileWatchersNeeded, innerFile, file);
32775
+ }
32776
+ for (const file of missing)if (filter(file)) {
32777
+ for (const innerFile of resolver.resolve(file))if (file === innerFile || filter(innerFile)) {
32778
+ missingFiles.add(file);
32779
+ addToMap(fileWatchersNeeded, innerFile, file);
32780
+ }
32781
+ }
32782
+ for (const dir of directories)if (filter(dir)) {
32783
+ let first = true;
32784
+ for (const innerItem of resolver.resolve(dir)){
32785
+ if (filter(innerItem)) addToMap(first ? directoryWatchersNeeded : fileWatchersNeeded, innerItem, dir);
32786
+ first = false;
32787
+ }
32788
+ }
32789
+ } else {
32790
+ for (const file of files)if (filter(file)) addToMap(fileWatchersNeeded, file, file);
32791
+ for (const file of missing)if (filter(file)) {
32792
+ missingFiles.add(file);
32793
+ addToMap(fileWatchersNeeded, file, file);
32794
+ }
32795
+ for (const dir of directories)if (filter(dir)) addToMap(directoryWatchersNeeded, dir, dir);
32796
+ }
32797
+ for (const [key, w] of fileWatchers){
32798
+ const needed = fileWatchersNeeded.get(key);
32799
+ if (void 0 === needed) {
32800
+ w.close();
32801
+ fileWatchers.delete(key);
32802
+ } else {
32803
+ w.update(needed);
32804
+ fileWatchersNeeded.delete(key);
32805
+ }
32806
+ }
32807
+ for (const [key, w] of directoryWatchers){
32808
+ const needed = directoryWatchersNeeded.get(key);
32809
+ if (void 0 === needed) {
32810
+ w.close();
32811
+ directoryWatchers.delete(key);
32812
+ } else {
32813
+ w.update(needed);
32814
+ directoryWatchersNeeded.delete(key);
32815
+ }
32816
+ }
32817
+ watchEventSource.batch(()=>{
32818
+ for (const [key, files] of fileWatchersNeeded){
32819
+ const watcher = this.watcherManager.watchFile(key, startTime);
32820
+ if (watcher) fileWatchers.set(key, new WatchpackFileWatcher(this, watcher, files));
32821
+ }
32822
+ for (const [key, directories] of directoryWatchersNeeded){
32823
+ const watcher = this.watcherManager.watchDirectory(key, startTime);
32824
+ if (watcher) directoryWatchers.set(key, new WatchpackDirectoryWatcher(this, watcher, directories));
32825
+ }
32826
+ });
32827
+ this._missing = missingFiles;
32828
+ this.startTime = startTime;
32829
+ }
32830
+ close() {
32831
+ this.paused = true;
32832
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
32833
+ for (const w of this.fileWatchers.values())w.close();
32834
+ for (const w of this.directoryWatchers.values())w.close();
32835
+ this.fileWatchers.clear();
32836
+ this.directoryWatchers.clear();
32837
+ }
32838
+ pause() {
32839
+ this.paused = true;
32840
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
32841
+ }
32842
+ getTimes() {
32843
+ const directoryWatchers = new Set();
32844
+ addWatchersToSet(this.fileWatchers.values(), directoryWatchers);
32845
+ addWatchersToSet(this.directoryWatchers.values(), directoryWatchers);
32846
+ const obj = Object.create(null);
32847
+ for (const w of directoryWatchers){
32848
+ const times = w.getTimes();
32849
+ for (const file of Object.keys(times))obj[file] = times[file];
32850
+ }
32851
+ return obj;
32852
+ }
32853
+ getTimeInfoEntries() {
32854
+ const map = new Map();
32855
+ this.collectTimeInfoEntries(map, map);
32856
+ return map;
32857
+ }
32858
+ collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
32859
+ const allWatchers = new Set();
32860
+ addWatchersToSet(this.fileWatchers.values(), allWatchers);
32861
+ addWatchersToSet(this.directoryWatchers.values(), allWatchers);
32862
+ for (const w of allWatchers)w.collectTimeInfoEntries(fileTimestamps, directoryTimestamps);
32863
+ }
32864
+ getAggregated() {
32865
+ if (this.aggregateTimer) {
32866
+ clearTimeout(this.aggregateTimer);
32867
+ this.aggregateTimer = void 0;
32868
+ }
32869
+ const changes = this.aggregatedChanges;
32870
+ const removals = this.aggregatedRemovals;
32871
+ this.aggregatedChanges = new Set();
32872
+ this.aggregatedRemovals = new Set();
32873
+ return {
32874
+ changes,
32875
+ removals
32876
+ };
32877
+ }
32878
+ _onChange(item, mtime, file, type) {
32879
+ file = file || item;
32880
+ if (!this.paused) {
32881
+ this.emit("change", file, mtime, type);
32882
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
32883
+ this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
32884
+ }
32885
+ this.aggregatedRemovals.delete(item);
32886
+ this.aggregatedChanges.add(item);
32887
+ }
32888
+ _onRemove(item, file, type) {
32889
+ file = file || item;
32890
+ if (!this.paused) {
32891
+ this.emit("remove", file, type);
32892
+ if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
32893
+ this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
32894
+ }
32895
+ this.aggregatedChanges.delete(item);
32896
+ this.aggregatedRemovals.add(item);
32897
+ }
32898
+ _onTimeout() {
32899
+ this.aggregateTimer = void 0;
32900
+ const changes = this.aggregatedChanges;
32901
+ const removals = this.aggregatedRemovals;
32902
+ this.aggregatedChanges = new Set();
32903
+ this.aggregatedRemovals = new Set();
32904
+ this.emit("aggregated", changes, removals);
32905
+ }
32906
+ }
32907
+ module.exports = Watchpack;
32908
+ },
32909
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/reducePlan.js" (module, __unused_rspack_exports, __webpack_require__) {
32617
32910
  const path = __webpack_require__("../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js");
32618
32911
  module.exports = (plan, limit)=>{
32619
32912
  const treeMap = new Map();
32620
- for (const [filePath, value] of plan)treeMap.set(filePath, {
32621
- filePath,
32913
+ for (const [target, value] of plan)treeMap.set(target, {
32914
+ target,
32622
32915
  parent: void 0,
32623
32916
  children: void 0,
32624
32917
  entries: 1,
@@ -32627,12 +32920,12 @@ __webpack_require__.add({
32627
32920
  });
32628
32921
  let currentCount = treeMap.size;
32629
32922
  for (const node of treeMap.values()){
32630
- const parentPath = path.dirname(node.filePath);
32631
- if (parentPath !== node.filePath) {
32923
+ const parentPath = path.dirname(node.target);
32924
+ if (parentPath !== node.target) {
32632
32925
  let parent = treeMap.get(parentPath);
32633
32926
  if (void 0 === parent) {
32634
32927
  parent = {
32635
- filePath: parentPath,
32928
+ target: parentPath,
32636
32929
  parent: void 0,
32637
32930
  children: [
32638
32931
  node
@@ -32675,7 +32968,7 @@ __webpack_require__.add({
32675
32968
  bestNode.active = true;
32676
32969
  bestNode.entries = 1;
32677
32970
  currentCount -= reduction;
32678
- let parent = bestNode.parent;
32971
+ let { parent } = bestNode;
32679
32972
  while(parent){
32680
32973
  parent.entries -= reduction;
32681
32974
  parent = parent.parent;
@@ -32695,26 +32988,26 @@ __webpack_require__.add({
32695
32988
  rootNode
32696
32989
  ]);
32697
32990
  for (const node of queue)if (!node.active || node === rootNode) {
32698
- if (node.value) if (Array.isArray(node.value)) for (const item of node.value)map.set(item, node.filePath);
32699
- else map.set(node.value, node.filePath);
32991
+ if (node.value) if (Array.isArray(node.value)) for (const item of node.value)map.set(item, node.target);
32992
+ else map.set(node.value, node.target);
32700
32993
  if (node.children) for (const child of node.children)queue.add(child);
32701
32994
  }
32702
- newPlan.set(rootNode.filePath, map);
32995
+ newPlan.set(rootNode.target, map);
32703
32996
  }
32704
32997
  return newPlan;
32705
32998
  };
32706
32999
  },
32707
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/watchEventSource.js" (__unused_rspack_module, exports, __webpack_require__) {
33000
+ "../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/watchEventSource.js" (module, __unused_rspack_exports, __webpack_require__) {
32708
33001
  var process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
33002
+ const { EventEmitter } = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js");
32709
33003
  const fs = __webpack_require__("./src/browser/fs.ts");
32710
33004
  const path = __webpack_require__("../../node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js");
32711
- const { EventEmitter } = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js");
32712
- const reducePlan = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/reducePlan.js");
33005
+ const reducePlan = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/reducePlan.js");
32713
33006
  const IS_OSX = "darwin" === __webpack_require__("../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js").iD();
32714
33007
  const IS_WIN = "win32" === __webpack_require__("../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js").iD();
32715
33008
  const SUPPORTS_RECURSIVE_WATCHING = IS_OSX || IS_WIN;
32716
33009
  const watcherLimit = +process.env.WATCHPACK_WATCHER_LIMIT || (IS_OSX ? 20 : 10000);
32717
- const recursiveWatcherLogging = !!process.env.WATCHPACK_RECURSIVE_WATCHER_LOGGING;
33010
+ const recursiveWatcherLogging = Boolean(process.env.WATCHPACK_RECURSIVE_WATCHER_LOGGING);
32718
33011
  let isBatch = false;
32719
33012
  let watcherCount = 0;
32720
33013
  const pendingWatchers = new Map();
@@ -32837,6 +33130,9 @@ __webpack_require__.add({
32837
33130
  }
32838
33131
  }
32839
33132
  class Watcher extends EventEmitter {
33133
+ constructor(){
33134
+ super();
33135
+ }
32840
33136
  close() {
32841
33137
  if (pendingWatchers.has(this)) return void pendingWatchers.delete(this);
32842
33138
  const watcher = underlyingWatcher.get(this);
@@ -32913,7 +33209,16 @@ __webpack_require__.add({
32913
33209
  }
32914
33210
  }
32915
33211
  };
32916
- exports.watch = (filePath)=>{
33212
+ module.exports.batch = (fn)=>{
33213
+ isBatch = true;
33214
+ try {
33215
+ fn();
33216
+ } finally{
33217
+ isBatch = false;
33218
+ execute();
33219
+ }
33220
+ };
33221
+ module.exports.watch = (filePath)=>{
32917
33222
  const watcher = new Watcher();
32918
33223
  const directWatcher = directWatchers.get(filePath);
32919
33224
  if (void 0 !== directWatcher) {
@@ -32935,306 +33240,6 @@ __webpack_require__.add({
32935
33240
  if (!isBatch) execute();
32936
33241
  return watcher;
32937
33242
  };
32938
- exports.batch = (fn)=>{
32939
- isBatch = true;
32940
- try {
32941
- fn();
32942
- } finally{
32943
- isBatch = false;
32944
- execute();
32945
- }
32946
- };
32947
- },
32948
- "../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/watchpack.js" (module, __unused_rspack_exports, __webpack_require__) {
32949
- const getWatcherManager = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/getWatcherManager.js");
32950
- const LinkResolver = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/LinkResolver.js");
32951
- const EventEmitter = __webpack_require__("../../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js").EventEmitter;
32952
- const globToRegExp = __webpack_require__("../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js");
32953
- const watchEventSource = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/watchEventSource.js");
32954
- const EMPTY_ARRAY = [];
32955
- const EMPTY_OPTIONS = {};
32956
- function addWatchersToSet(watchers, set) {
32957
- for (const ww of watchers){
32958
- const w = ww.watcher;
32959
- if (!set.has(w.directoryWatcher)) set.add(w.directoryWatcher);
32960
- }
32961
- }
32962
- const stringToRegexp = (ignored)=>{
32963
- if (0 === ignored.length) return;
32964
- const source = globToRegExp(ignored, {
32965
- globstar: true,
32966
- extended: true
32967
- }).source;
32968
- return source.slice(0, source.length - 1) + "(?:$|\\/)";
32969
- };
32970
- const ignoredToFunction = (ignored)=>{
32971
- if (Array.isArray(ignored)) {
32972
- const stringRegexps = ignored.map((i)=>stringToRegexp(i)).filter(Boolean);
32973
- if (0 === stringRegexps.length) return ()=>false;
32974
- const regexp = new RegExp(stringRegexps.join("|"));
32975
- return (x)=>regexp.test(x.replace(/\\/g, "/"));
32976
- }
32977
- if ("string" == typeof ignored) {
32978
- const stringRegexp = stringToRegexp(ignored);
32979
- if (!stringRegexp) return ()=>false;
32980
- const regexp = new RegExp(stringRegexp);
32981
- return (x)=>regexp.test(x.replace(/\\/g, "/"));
32982
- }
32983
- if (ignored instanceof RegExp) return (x)=>ignored.test(x.replace(/\\/g, "/"));
32984
- if (ignored instanceof Function) return ignored;
32985
- if (!ignored) return ()=>false;
32986
- else throw new Error(`Invalid option for 'ignored': ${ignored}`);
32987
- };
32988
- const normalizeOptions = (options)=>({
32989
- followSymlinks: !!options.followSymlinks,
32990
- ignored: ignoredToFunction(options.ignored),
32991
- poll: options.poll
32992
- });
32993
- const normalizeCache = new WeakMap();
32994
- const cachedNormalizeOptions = (options)=>{
32995
- const cacheEntry = normalizeCache.get(options);
32996
- if (void 0 !== cacheEntry) return cacheEntry;
32997
- const normalized = normalizeOptions(options);
32998
- normalizeCache.set(options, normalized);
32999
- return normalized;
33000
- };
33001
- class WatchpackFileWatcher {
33002
- constructor(watchpack, watcher, files){
33003
- this.files = Array.isArray(files) ? files : [
33004
- files
33005
- ];
33006
- this.watcher = watcher;
33007
- watcher.on("initial-missing", (type)=>{
33008
- for (const file of this.files)if (!watchpack._missing.has(file)) watchpack._onRemove(file, file, type);
33009
- });
33010
- watcher.on("change", (mtime, type)=>{
33011
- for (const file of this.files)watchpack._onChange(file, mtime, file, type);
33012
- });
33013
- watcher.on("remove", (type)=>{
33014
- for (const file of this.files)watchpack._onRemove(file, file, type);
33015
- });
33016
- }
33017
- update(files) {
33018
- if (Array.isArray(files)) this.files = files;
33019
- else if (1 !== this.files.length) this.files = [
33020
- files
33021
- ];
33022
- else if (this.files[0] !== files) this.files[0] = files;
33023
- }
33024
- close() {
33025
- this.watcher.close();
33026
- }
33027
- }
33028
- class WatchpackDirectoryWatcher {
33029
- constructor(watchpack, watcher, directories){
33030
- this.directories = Array.isArray(directories) ? directories : [
33031
- directories
33032
- ];
33033
- this.watcher = watcher;
33034
- watcher.on("initial-missing", (type)=>{
33035
- for (const item of this.directories)watchpack._onRemove(item, item, type);
33036
- });
33037
- watcher.on("change", (file, mtime, type)=>{
33038
- for (const item of this.directories)watchpack._onChange(item, mtime, file, type);
33039
- });
33040
- watcher.on("remove", (type)=>{
33041
- for (const item of this.directories)watchpack._onRemove(item, item, type);
33042
- });
33043
- }
33044
- update(directories) {
33045
- if (Array.isArray(directories)) this.directories = directories;
33046
- else if (1 !== this.directories.length) this.directories = [
33047
- directories
33048
- ];
33049
- else if (this.directories[0] !== directories) this.directories[0] = directories;
33050
- }
33051
- close() {
33052
- this.watcher.close();
33053
- }
33054
- }
33055
- class Watchpack extends EventEmitter {
33056
- constructor(options){
33057
- super();
33058
- if (!options) options = EMPTY_OPTIONS;
33059
- this.options = options;
33060
- this.aggregateTimeout = "number" == typeof options.aggregateTimeout ? options.aggregateTimeout : 200;
33061
- this.watcherOptions = cachedNormalizeOptions(options);
33062
- this.watcherManager = getWatcherManager(this.watcherOptions);
33063
- this.fileWatchers = new Map();
33064
- this.directoryWatchers = new Map();
33065
- this._missing = new Set();
33066
- this.startTime = void 0;
33067
- this.paused = false;
33068
- this.aggregatedChanges = new Set();
33069
- this.aggregatedRemovals = new Set();
33070
- this.aggregateTimer = void 0;
33071
- this._onTimeout = this._onTimeout.bind(this);
33072
- }
33073
- watch(arg1, arg2, arg3) {
33074
- let files, directories, missing, startTime;
33075
- if (arg2) {
33076
- files = arg1;
33077
- directories = arg2;
33078
- missing = EMPTY_ARRAY;
33079
- startTime = arg3;
33080
- } else ({ files = EMPTY_ARRAY, directories = EMPTY_ARRAY, missing = EMPTY_ARRAY, startTime } = arg1);
33081
- this.paused = false;
33082
- const fileWatchers = this.fileWatchers;
33083
- const directoryWatchers = this.directoryWatchers;
33084
- const ignored = this.watcherOptions.ignored;
33085
- const filter = (path)=>!ignored(path);
33086
- const addToMap = (map, key, item)=>{
33087
- const list = map.get(key);
33088
- if (void 0 === list) map.set(key, item);
33089
- else if (Array.isArray(list)) list.push(item);
33090
- else map.set(key, [
33091
- list,
33092
- item
33093
- ]);
33094
- };
33095
- const fileWatchersNeeded = new Map();
33096
- const directoryWatchersNeeded = new Map();
33097
- const missingFiles = new Set();
33098
- if (this.watcherOptions.followSymlinks) {
33099
- const resolver = new LinkResolver();
33100
- for (const file of files)if (filter(file)) {
33101
- for (const innerFile of resolver.resolve(file))if (file === innerFile || filter(innerFile)) addToMap(fileWatchersNeeded, innerFile, file);
33102
- }
33103
- for (const file of missing)if (filter(file)) {
33104
- for (const innerFile of resolver.resolve(file))if (file === innerFile || filter(innerFile)) {
33105
- missingFiles.add(file);
33106
- addToMap(fileWatchersNeeded, innerFile, file);
33107
- }
33108
- }
33109
- for (const dir of directories)if (filter(dir)) {
33110
- let first = true;
33111
- for (const innerItem of resolver.resolve(dir)){
33112
- if (filter(innerItem)) addToMap(first ? directoryWatchersNeeded : fileWatchersNeeded, innerItem, dir);
33113
- first = false;
33114
- }
33115
- }
33116
- } else {
33117
- for (const file of files)if (filter(file)) addToMap(fileWatchersNeeded, file, file);
33118
- for (const file of missing)if (filter(file)) {
33119
- missingFiles.add(file);
33120
- addToMap(fileWatchersNeeded, file, file);
33121
- }
33122
- for (const dir of directories)if (filter(dir)) addToMap(directoryWatchersNeeded, dir, dir);
33123
- }
33124
- for (const [key, w] of fileWatchers){
33125
- const needed = fileWatchersNeeded.get(key);
33126
- if (void 0 === needed) {
33127
- w.close();
33128
- fileWatchers.delete(key);
33129
- } else {
33130
- w.update(needed);
33131
- fileWatchersNeeded.delete(key);
33132
- }
33133
- }
33134
- for (const [key, w] of directoryWatchers){
33135
- const needed = directoryWatchersNeeded.get(key);
33136
- if (void 0 === needed) {
33137
- w.close();
33138
- directoryWatchers.delete(key);
33139
- } else {
33140
- w.update(needed);
33141
- directoryWatchersNeeded.delete(key);
33142
- }
33143
- }
33144
- watchEventSource.batch(()=>{
33145
- for (const [key, files] of fileWatchersNeeded){
33146
- const watcher = this.watcherManager.watchFile(key, startTime);
33147
- if (watcher) fileWatchers.set(key, new WatchpackFileWatcher(this, watcher, files));
33148
- }
33149
- for (const [key, directories] of directoryWatchersNeeded){
33150
- const watcher = this.watcherManager.watchDirectory(key, startTime);
33151
- if (watcher) directoryWatchers.set(key, new WatchpackDirectoryWatcher(this, watcher, directories));
33152
- }
33153
- });
33154
- this._missing = missingFiles;
33155
- this.startTime = startTime;
33156
- }
33157
- close() {
33158
- this.paused = true;
33159
- if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
33160
- for (const w of this.fileWatchers.values())w.close();
33161
- for (const w of this.directoryWatchers.values())w.close();
33162
- this.fileWatchers.clear();
33163
- this.directoryWatchers.clear();
33164
- }
33165
- pause() {
33166
- this.paused = true;
33167
- if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
33168
- }
33169
- getTimes() {
33170
- const directoryWatchers = new Set();
33171
- addWatchersToSet(this.fileWatchers.values(), directoryWatchers);
33172
- addWatchersToSet(this.directoryWatchers.values(), directoryWatchers);
33173
- const obj = Object.create(null);
33174
- for (const w of directoryWatchers){
33175
- const times = w.getTimes();
33176
- for (const file of Object.keys(times))obj[file] = times[file];
33177
- }
33178
- return obj;
33179
- }
33180
- getTimeInfoEntries() {
33181
- const map = new Map();
33182
- this.collectTimeInfoEntries(map, map);
33183
- return map;
33184
- }
33185
- collectTimeInfoEntries(fileTimestamps, directoryTimestamps) {
33186
- const allWatchers = new Set();
33187
- addWatchersToSet(this.fileWatchers.values(), allWatchers);
33188
- addWatchersToSet(this.directoryWatchers.values(), allWatchers);
33189
- const safeTime = {
33190
- value: 0
33191
- };
33192
- for (const w of allWatchers)w.collectTimeInfoEntries(fileTimestamps, directoryTimestamps, safeTime);
33193
- }
33194
- getAggregated() {
33195
- if (this.aggregateTimer) {
33196
- clearTimeout(this.aggregateTimer);
33197
- this.aggregateTimer = void 0;
33198
- }
33199
- const changes = this.aggregatedChanges;
33200
- const removals = this.aggregatedRemovals;
33201
- this.aggregatedChanges = new Set();
33202
- this.aggregatedRemovals = new Set();
33203
- return {
33204
- changes,
33205
- removals
33206
- };
33207
- }
33208
- _onChange(item, mtime, file, type) {
33209
- file = file || item;
33210
- if (!this.paused) {
33211
- this.emit("change", file, mtime, type);
33212
- if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
33213
- this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
33214
- }
33215
- this.aggregatedRemovals.delete(item);
33216
- this.aggregatedChanges.add(item);
33217
- }
33218
- _onRemove(item, file, type) {
33219
- file = file || item;
33220
- if (!this.paused) {
33221
- this.emit("remove", file, type);
33222
- if (this.aggregateTimer) clearTimeout(this.aggregateTimer);
33223
- this.aggregateTimer = setTimeout(this._onTimeout, this.aggregateTimeout);
33224
- }
33225
- this.aggregatedChanges.delete(item);
33226
- this.aggregatedRemovals.add(item);
33227
- }
33228
- _onTimeout() {
33229
- this.aggregateTimer = void 0;
33230
- const changes = this.aggregatedChanges;
33231
- const removals = this.aggregatedRemovals;
33232
- this.aggregatedChanges = new Set();
33233
- this.aggregatedRemovals = new Set();
33234
- this.emit("aggregated", changes, removals);
33235
- }
33236
- }
33237
- module.exports = Watchpack;
33238
33243
  },
33239
33244
  "../../node_modules/.pnpm/webpack-sources@3.3.4_patch_hash=0d62122aa5f9ac77d9ad3b4959c3c0492778a5948c0b00b45a673f3facfca327/node_modules/webpack-sources/lib/CachedSource.js" (module, __unused_rspack_exports, __webpack_require__) {
33240
33245
  var Buffer = __webpack_require__("./src/browser/buffer.ts")["Buffer"];
@@ -55160,7 +55165,7 @@ Object.defineProperty(Chunk.prototype, 'getChunkMaps', {
55160
55165
  const chunkNameMap = {};
55161
55166
  for (const chunk of this.getAllAsyncChunks()){
55162
55167
  const id = chunk.id;
55163
- if (!id) continue;
55168
+ if (void 0 === id) continue;
55164
55169
  const chunkHash = realHash ? chunk.hash : chunk.renderedHash;
55165
55170
  if (chunkHash) chunkHashMap[id] = chunkHash;
55166
55171
  for (const key of Object.keys(chunk.contentHash)){
@@ -55409,6 +55414,22 @@ function _type_of(obj) {
55409
55414
  return obj && "u" > typeof Symbol && obj.constructor === Symbol ? "symbol" : typeof obj;
55410
55415
  }
55411
55416
  let _computedKey, _computedKey1, _computedKey2;
55417
+ function normalizePathData(data = {}) {
55418
+ const pathData = {
55419
+ filename: data.filename,
55420
+ hash: data.hash,
55421
+ contentHash: data.contentHash,
55422
+ runtime: data.runtime,
55423
+ url: data.url
55424
+ };
55425
+ if (void 0 !== data.id) pathData.id = String(data.id);
55426
+ if (data.chunk) pathData.chunk = {
55427
+ id: void 0 !== data.chunk.id ? String(data.chunk.id) : void 0,
55428
+ name: data.chunk.name,
55429
+ hash: data.chunk.hash
55430
+ };
55431
+ return pathData;
55432
+ }
55412
55433
  const checkCompilation = (compilation)=>{
55413
55434
  if (!(compilation instanceof Compilation)) throw new 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.');
55414
55435
  };
@@ -55777,30 +55798,22 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
55777
55798
  this.#warnings.splice(0, this.#warnings.length, ...warnings);
55778
55799
  }
55779
55800
  getPath(filename, data = {}) {
55780
- const pathData = {
55781
- ...data
55782
- };
55801
+ const pathData = normalizePathData(data);
55783
55802
  if (data.contentHashType && data.chunk?.contentHash) pathData.contentHash = data.chunk.contentHash[data.contentHashType];
55784
55803
  return this.#inner.getPath(filename, pathData);
55785
55804
  }
55786
55805
  getPathWithInfo(filename, data = {}) {
55787
- const pathData = {
55788
- ...data
55789
- };
55806
+ const pathData = normalizePathData(data);
55790
55807
  if (data.contentHashType && data.chunk?.contentHash) pathData.contentHash = data.chunk.contentHash[data.contentHashType];
55791
55808
  return this.#inner.getPathWithInfo(filename, pathData);
55792
55809
  }
55793
55810
  getAssetPath(filename, data = {}) {
55794
- const pathData = {
55795
- ...data
55796
- };
55811
+ const pathData = normalizePathData(data);
55797
55812
  if (data.contentHashType && data.chunk?.contentHash) pathData.contentHash = data.chunk.contentHash[data.contentHashType];
55798
55813
  return this.#inner.getAssetPath(filename, pathData);
55799
55814
  }
55800
55815
  getAssetPathWithInfo(filename, data = {}) {
55801
- const pathData = {
55802
- ...data
55803
- };
55816
+ const pathData = normalizePathData(data);
55804
55817
  if (data.contentHashType && data.chunk?.contentHash) pathData.contentHash = data.chunk.contentHash[data.contentHashType];
55805
55818
  return this.#inner.getAssetPathWithInfo(filename, pathData);
55806
55819
  }
@@ -61839,7 +61852,7 @@ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffecte
61839
61852
  });
61840
61853
  D(output, 'bundlerInfo', {});
61841
61854
  if ('object' == typeof output.bundlerInfo) {
61842
- D(output.bundlerInfo, 'version', "2.0.1");
61855
+ D(output.bundlerInfo, 'version', "2.0.2");
61843
61856
  D(output.bundlerInfo, 'bundler', 'rspack');
61844
61857
  D(output.bundlerInfo, 'force', false);
61845
61858
  }
@@ -63497,7 +63510,7 @@ class MultiStats {
63497
63510
  return obj;
63498
63511
  });
63499
63512
  if (childOptions.version) {
63500
- obj.rspackVersion = "2.0.1";
63513
+ obj.rspackVersion = "2.0.2";
63501
63514
  obj.version = "5.75.0";
63502
63515
  }
63503
63516
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -64162,7 +64175,7 @@ class NodeWatchFileSystem {
64162
64175
  if ('object' != typeof options) throw new Error("Invalid arguments: 'options'");
64163
64176
  if ('function' != typeof callbackUndelayed && callbackUndelayed) throw new Error("Invalid arguments: 'callbackUndelayed'");
64164
64177
  const oldWatcher = this.watcher;
64165
- const Watchpack = __webpack_require__("../../node_modules/.pnpm/watchpack@2.4.4/node_modules/watchpack/lib/watchpack.js");
64178
+ const Watchpack = __webpack_require__("../../node_modules/.pnpm/watchpack@2.5.1/node_modules/watchpack/lib/index.js");
64166
64179
  this.watcher = new Watchpack(options);
64167
64180
  if (callbackUndelayed) this.watcher?.once('change', callbackUndelayed);
64168
64181
  const fetchTimeInfo = ()=>{
@@ -65012,7 +65025,7 @@ const MODULES_SORTER = {
65012
65025
  const SORTERS = {
65013
65026
  'compilation.chunks': {
65014
65027
  _: (comparators)=>{
65015
- comparators.push(compareSelect((c)=>c.id, DefaultStatsFactoryPlugin_compareIds));
65028
+ comparators.push(compareSelect((c)=>void 0 === c.id ? void 0 : String(c.id), DefaultStatsFactoryPlugin_compareIds));
65016
65029
  }
65017
65030
  },
65018
65031
  'compilation.modules': MODULES_SORTER,
@@ -65133,7 +65146,10 @@ const SIMPLE_EXTRACTORS = {
65133
65146
  LogType.error
65134
65147
  ]) : getLogTypesBitFlag([]);
65135
65148
  object.logging = {};
65136
- const compilationLogging = compilation.logging;
65149
+ const compilationLogging = new Map();
65150
+ for (const [origin, logEntries] of compilation.logging)compilationLogging.set(origin, [
65151
+ ...logEntries
65152
+ ]);
65137
65153
  for (const { name, ...rest } of context.getInner(compilation).getLogging(acceptedTypes)){
65138
65154
  const value = compilationLogging.get(name);
65139
65155
  const entry = {
@@ -65200,7 +65216,7 @@ const SIMPLE_EXTRACTORS = {
65200
65216
  },
65201
65217
  version: (object)=>{
65202
65218
  object.version = "5.75.0";
65203
- object.rspackVersion = "2.0.1";
65219
+ object.rspackVersion = "2.0.2";
65204
65220
  },
65205
65221
  env: (object, _compilation, _context, { _env })=>{
65206
65222
  object.env = _env;
@@ -70029,7 +70045,7 @@ function transformSync(source, options) {
70029
70045
  const _options = JSON.stringify(options || {});
70030
70046
  return rspack_wasi_browser.transformSync(source, _options);
70031
70047
  }
70032
- const exports_rspackVersion = "2.0.1";
70048
+ const exports_rspackVersion = "2.0.2";
70033
70049
  const exports_version = "5.75.0";
70034
70050
  const exports_WebpackError = Error;
70035
70051
  const exports_config = {