@rspack/dev-server 2.1.0 → 2.2.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.
@@ -8,5 +8,5 @@
8
8
  * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
9
9
  */
10
10
  import { type LoggerOptions, type LoggingFunction } from '../types.js';
11
- declare const _default: ({ level, debug, console, }: LoggerOptions) => LoggingFunction;
12
11
  export default _default;
12
+ declare function _default({ level, debug, console, }: LoggerOptions): LoggingFunction;
@@ -16,9 +16,11 @@ declare class SyncBailHook {
16
16
  constructor(_args?: string[]);
17
17
  call(_origin?: string, _type?: string, _args?: unknown): undefined;
18
18
  }
19
+ declare const configureDefaultLogger: (options: LoggerOptions) => void;
20
+ declare const getLogger: (name: string) => Logger;
19
21
  export declare const logger: {
20
- getLogger: (name: string) => Logger;
21
- configureDefaultLogger: (options: LoggerOptions) => void;
22
+ getLogger: typeof getLogger;
23
+ configureDefaultLogger: typeof configureDefaultLogger;
22
24
  hooks: {
23
25
  log: SyncBailHook;
24
26
  };
@@ -21,7 +21,7 @@ type Event = {
21
21
  type StateMachine = {
22
22
  send: (event: Event) => void;
23
23
  };
24
- declare const formatProblem: (type: "warning" | "error", item: string | Message) => {
24
+ declare const formatProblem: (type: 'warning' | 'error', item: string | Message) => {
25
25
  header: string;
26
26
  body: string;
27
27
  };
package/client/overlay.js CHANGED
@@ -408,7 +408,11 @@ const createOverlay = (options)=>{
408
408
  });
409
409
  }, trustedTypesPolicyName);
410
410
  }
411
- let handleEscapeKey;
411
+ function handleEscapeKey(event) {
412
+ if ('Escape' === event.key || 'Esc' === event.key || 27 === event.keyCode) overlayService.send({
413
+ type: 'DISMISS'
414
+ });
415
+ }
412
416
  const hideOverlayWithEscCleanup = ()=>{
413
417
  window.removeEventListener('keydown', handleEscapeKey);
414
418
  hide();
@@ -417,11 +421,6 @@ const createOverlay = (options)=>{
417
421
  showOverlay: ({ level = 'error', messages, messageSource })=>show(level, messages, options.trustedTypesPolicyName, messageSource),
418
422
  hideOverlay: hideOverlayWithEscCleanup
419
423
  });
420
- handleEscapeKey = (event)=>{
421
- if ('Escape' === event.key || 'Esc' === event.key || 27 === event.keyCode) overlayService.send({
422
- type: 'DISMISS'
423
- });
424
- };
425
424
  window.addEventListener('keydown', handleEscapeKey);
426
425
  if (options.catchRuntimeError) {
427
426
  const handleError = (error, fallbackMessage)=>{
@@ -22,9 +22,9 @@ declare const _closeTags: Record<string, string | ((ansiCodes: Option<Array<stri
22
22
  * Converts text with ANSI color codes to HTML markup.
23
23
  */
24
24
  declare function ansiHTML(text: string): string;
25
+ export default ansiHTML;
25
26
  declare namespace ansiHTML {
26
27
  var setColors: (colors: typeof _defColors) => void;
27
28
  var reset: () => void;
28
29
  var tags: AnsiHtmlTags;
29
30
  }
30
- export default ansiHTML;
@@ -1,12 +1,12 @@
1
1
  /*! LICENSE: 0~chokidar.js.LICENSE.txt */
2
- import { __webpack_require__ } from "./944.js";
2
+ import { __webpack_require__ } from "./619.js";
3
3
  import { EventEmitter } from "node:events";
4
4
  import { stat as external_node_fs_stat, unwatchFile, watch, watchFile } from "node:fs";
5
5
  import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "node:fs/promises";
6
6
  import { join, relative as external_node_path_relative, resolve as external_node_path_resolve, sep } from "node:path";
7
7
  import { Readable } from "node:stream";
8
8
  import { type as external_node_os_type } from "node:os";
9
- import * as __rspack_external_node_path_c5b9b54f from "node:path";
9
+ import * as __rspack_external_node_path_806ed179 from "node:path";
10
10
  var chokidar_namespaceObject = {};
11
11
  __webpack_require__.r(chokidar_namespaceObject);
12
12
  __webpack_require__.d(chokidar_namespaceObject, {
@@ -539,7 +539,7 @@ const binaryExtensions = new Set([
539
539
  'zip',
540
540
  'zipx'
541
541
  ]);
542
- const isBinaryPath = (filePath)=>binaryExtensions.has(__rspack_external_node_path_c5b9b54f.extname(filePath).slice(1).toLowerCase());
542
+ const isBinaryPath = (filePath)=>binaryExtensions.has(__rspack_external_node_path_806ed179.extname(filePath).slice(1).toLowerCase());
543
543
  const foreach = (val, fn)=>{
544
544
  if (val instanceof Set) val.forEach(fn);
545
545
  else fn(val);
@@ -569,7 +569,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
569
569
  emitRaw(rawEvent, evPath, {
570
570
  watchedPath: path
571
571
  });
572
- if (evPath && path !== evPath) fsWatchBroadcast(__rspack_external_node_path_c5b9b54f.resolve(path, evPath), KEY_LISTENERS, __rspack_external_node_path_c5b9b54f.join(path, evPath));
572
+ if (evPath && path !== evPath) fsWatchBroadcast(__rspack_external_node_path_806ed179.resolve(path, evPath), KEY_LISTENERS, __rspack_external_node_path_806ed179.join(path, evPath));
573
573
  };
574
574
  try {
575
575
  return watch(path, {
@@ -684,11 +684,11 @@ class NodeFsHandler {
684
684
  }
685
685
  _watchWithNodeFs(path, listener) {
686
686
  const opts = this.fsw.options;
687
- const directory = __rspack_external_node_path_c5b9b54f.dirname(path);
688
- const basename = __rspack_external_node_path_c5b9b54f.basename(path);
687
+ const directory = __rspack_external_node_path_806ed179.dirname(path);
688
+ const basename = __rspack_external_node_path_806ed179.basename(path);
689
689
  const parent = this.fsw._getWatchedDir(directory);
690
690
  parent.add(basename);
691
- const absolutePath = __rspack_external_node_path_c5b9b54f.resolve(path);
691
+ const absolutePath = __rspack_external_node_path_806ed179.resolve(path);
692
692
  const options = {
693
693
  persistent: opts.persistent
694
694
  };
@@ -710,8 +710,8 @@ class NodeFsHandler {
710
710
  }
711
711
  _handleFile(file, stats, initialAdd) {
712
712
  if (this.fsw.closed) return;
713
- const dirname = __rspack_external_node_path_c5b9b54f.dirname(file);
714
- const basename = __rspack_external_node_path_c5b9b54f.basename(file);
713
+ const dirname = __rspack_external_node_path_806ed179.dirname(file);
714
+ const basename = __rspack_external_node_path_806ed179.basename(file);
715
715
  const parent = this.fsw._getWatchedDir(dirname);
716
716
  let prevStats = stats;
717
717
  if (parent.has(basename)) return;
@@ -778,7 +778,7 @@ class NodeFsHandler {
778
778
  this.fsw._symlinkPaths.set(full, true);
779
779
  }
780
780
  _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
781
- directory = __rspack_external_node_path_c5b9b54f.join(directory, '');
781
+ directory = __rspack_external_node_path_806ed179.join(directory, '');
782
782
  const throttleKey = target ? `${directory}:${target}` : directory;
783
783
  throttler = this.fsw._throttle('readdir', throttleKey, 1000);
784
784
  if (!throttler) return;
@@ -795,7 +795,7 @@ class NodeFsHandler {
795
795
  return;
796
796
  }
797
797
  const item = entry.path;
798
- let path = __rspack_external_node_path_c5b9b54f.join(directory, item);
798
+ let path = __rspack_external_node_path_806ed179.join(directory, item);
799
799
  current.add(item);
800
800
  if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) return;
801
801
  if (this.fsw.closed) {
@@ -804,7 +804,7 @@ class NodeFsHandler {
804
804
  }
805
805
  if (item === target || !target && !previous.has(item)) {
806
806
  this.fsw._incrReadyCount();
807
- path = __rspack_external_node_path_c5b9b54f.join(dir, __rspack_external_node_path_c5b9b54f.relative(dir, path));
807
+ path = __rspack_external_node_path_806ed179.join(dir, __rspack_external_node_path_806ed179.relative(dir, path));
808
808
  this._addToNodeFs(path, initialAdd, wh, depth + 1);
809
809
  }
810
810
  }).on(EV.ERROR, this._boundHandleError);
@@ -826,10 +826,10 @@ class NodeFsHandler {
826
826
  });
827
827
  }
828
828
  async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
829
- const parentDir = this.fsw._getWatchedDir(__rspack_external_node_path_c5b9b54f.dirname(dir));
830
- const tracked = parentDir.has(__rspack_external_node_path_c5b9b54f.basename(dir));
829
+ const parentDir = this.fsw._getWatchedDir(__rspack_external_node_path_806ed179.dirname(dir));
830
+ const tracked = parentDir.has(__rspack_external_node_path_806ed179.basename(dir));
831
831
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) this.fsw._emit(EV.ADD_DIR, dir, stats);
832
- parentDir.add(__rspack_external_node_path_c5b9b54f.basename(dir));
832
+ parentDir.add(__rspack_external_node_path_806ed179.basename(dir));
833
833
  this.fsw._getWatchedDir(dir);
834
834
  let throttler;
835
835
  let closer;
@@ -867,7 +867,7 @@ class NodeFsHandler {
867
867
  const follow = this.fsw.options.followSymlinks;
868
868
  let closer;
869
869
  if (stats.isDirectory()) {
870
- const absPath = __rspack_external_node_path_c5b9b54f.resolve(path);
870
+ const absPath = __rspack_external_node_path_806ed179.resolve(path);
871
871
  const targetPath = follow ? await promises_realpath(path) : path;
872
872
  if (this.fsw.closed) return;
873
873
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -876,12 +876,12 @@ class NodeFsHandler {
876
876
  } else if (stats.isSymbolicLink()) {
877
877
  const targetPath = follow ? await promises_realpath(path) : path;
878
878
  if (this.fsw.closed) return;
879
- const parent = __rspack_external_node_path_c5b9b54f.dirname(wh.watchPath);
879
+ const parent = __rspack_external_node_path_806ed179.dirname(wh.watchPath);
880
880
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
881
881
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
882
882
  closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
883
883
  if (this.fsw.closed) return;
884
- if (void 0 !== targetPath) this.fsw._symlinkPaths.set(__rspack_external_node_path_c5b9b54f.resolve(path), targetPath);
884
+ if (void 0 !== targetPath) this.fsw._symlinkPaths.set(__rspack_external_node_path_806ed179.resolve(path), targetPath);
885
885
  } else closer = this._handleFile(wh.watchPath, stats, initialAdd);
886
886
  ready();
887
887
  if (closer) this.fsw._addPathCloser(path, closer);
@@ -916,9 +916,9 @@ function createPattern(matcher) {
916
916
  if ('object' == typeof matcher && null !== matcher) return (string)=>{
917
917
  if (matcher.path === string) return true;
918
918
  if (matcher.recursive) {
919
- const relative = __rspack_external_node_path_c5b9b54f.relative(matcher.path, string);
919
+ const relative = __rspack_external_node_path_806ed179.relative(matcher.path, string);
920
920
  if (!relative) return false;
921
- return !relative.startsWith('..') && !__rspack_external_node_path_c5b9b54f.isAbsolute(relative);
921
+ return !relative.startsWith('..') && !__rspack_external_node_path_806ed179.isAbsolute(relative);
922
922
  }
923
923
  return false;
924
924
  };
@@ -926,7 +926,7 @@ function createPattern(matcher) {
926
926
  }
927
927
  function normalizePath(path) {
928
928
  if ('string' != typeof path) throw new Error('string expected');
929
- path = __rspack_external_node_path_c5b9b54f.normalize(path);
929
+ path = __rspack_external_node_path_806ed179.normalize(path);
930
930
  path = path.replace(/\\/g, '/');
931
931
  let prepend = false;
932
932
  if (path.startsWith('//')) prepend = true;
@@ -962,14 +962,14 @@ const toUnix = (string)=>{
962
962
  if (prepend) str = SLASH + str;
963
963
  return str;
964
964
  };
965
- const normalizePathToUnix = (path)=>toUnix(__rspack_external_node_path_c5b9b54f.normalize(toUnix(path)));
965
+ const normalizePathToUnix = (path)=>toUnix(__rspack_external_node_path_806ed179.normalize(toUnix(path)));
966
966
  const normalizeIgnored = (cwd = '')=>(path)=>{
967
- if ('string' == typeof path) return normalizePathToUnix(__rspack_external_node_path_c5b9b54f.isAbsolute(path) ? path : __rspack_external_node_path_c5b9b54f.join(cwd, path));
967
+ if ('string' == typeof path) return normalizePathToUnix(__rspack_external_node_path_806ed179.isAbsolute(path) ? path : __rspack_external_node_path_806ed179.join(cwd, path));
968
968
  return path;
969
969
  };
970
970
  const getAbsolutePath = (path, cwd)=>{
971
- if (__rspack_external_node_path_c5b9b54f.isAbsolute(path)) return path;
972
- return __rspack_external_node_path_c5b9b54f.join(cwd, path);
971
+ if (__rspack_external_node_path_806ed179.isAbsolute(path)) return path;
972
+ return __rspack_external_node_path_806ed179.join(cwd, path);
973
973
  };
974
974
  const EMPTY_SET = Object.freeze(new Set());
975
975
  class DirEntry {
@@ -995,7 +995,7 @@ class DirEntry {
995
995
  try {
996
996
  await readdir(dir);
997
997
  } catch (err) {
998
- if (this._removeWatcher) this._removeWatcher(__rspack_external_node_path_c5b9b54f.dirname(dir), __rspack_external_node_path_c5b9b54f.basename(dir));
998
+ if (this._removeWatcher) this._removeWatcher(__rspack_external_node_path_806ed179.dirname(dir), __rspack_external_node_path_806ed179.basename(dir));
999
999
  }
1000
1000
  }
1001
1001
  has(item) {
@@ -1033,7 +1033,7 @@ class WatchHelper {
1033
1033
  const watchPath = path;
1034
1034
  this.path = path = path.replace(REPLACER_RE, '');
1035
1035
  this.watchPath = watchPath;
1036
- this.fullWatchPath = __rspack_external_node_path_c5b9b54f.resolve(watchPath);
1036
+ this.fullWatchPath = __rspack_external_node_path_806ed179.resolve(watchPath);
1037
1037
  this.dirParts = [];
1038
1038
  this.dirParts.forEach((parts)=>{
1039
1039
  if (parts.length > 1) parts.pop();
@@ -1042,7 +1042,7 @@ class WatchHelper {
1042
1042
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
1043
1043
  }
1044
1044
  entryPath(entry) {
1045
- return __rspack_external_node_path_c5b9b54f.join(this.watchPath, __rspack_external_node_path_c5b9b54f.relative(this.watchPath, entry.fullPath));
1045
+ return __rspack_external_node_path_806ed179.join(this.watchPath, __rspack_external_node_path_806ed179.relative(this.watchPath, entry.fullPath));
1046
1046
  }
1047
1047
  filterPath(entry) {
1048
1048
  const { stats } = entry;
@@ -1167,7 +1167,7 @@ class FSWatcher extends EventEmitter {
1167
1167
  })).then((results)=>{
1168
1168
  if (this.closed) return;
1169
1169
  results.forEach((item)=>{
1170
- if (item) this.add(__rspack_external_node_path_c5b9b54f.dirname(item), __rspack_external_node_path_c5b9b54f.basename(_origAdd || item));
1170
+ if (item) this.add(__rspack_external_node_path_806ed179.dirname(item), __rspack_external_node_path_806ed179.basename(_origAdd || item));
1171
1171
  });
1172
1172
  });
1173
1173
  return this;
@@ -1177,9 +1177,9 @@ class FSWatcher extends EventEmitter {
1177
1177
  const paths = unifyPaths(paths_);
1178
1178
  const { cwd } = this.options;
1179
1179
  paths.forEach((path)=>{
1180
- if (!__rspack_external_node_path_c5b9b54f.isAbsolute(path) && !this._closers.has(path)) {
1181
- if (cwd) path = __rspack_external_node_path_c5b9b54f.join(cwd, path);
1182
- path = __rspack_external_node_path_c5b9b54f.resolve(path);
1180
+ if (!__rspack_external_node_path_806ed179.isAbsolute(path) && !this._closers.has(path)) {
1181
+ if (cwd) path = __rspack_external_node_path_806ed179.join(cwd, path);
1182
+ path = __rspack_external_node_path_806ed179.resolve(path);
1183
1183
  }
1184
1184
  this._closePath(path);
1185
1185
  this._addIgnoredPath(path);
@@ -1216,7 +1216,7 @@ class FSWatcher extends EventEmitter {
1216
1216
  getWatched() {
1217
1217
  const watchList = {};
1218
1218
  this._watched.forEach((entry, dir)=>{
1219
- const key = this.options.cwd ? __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, dir) : dir;
1219
+ const key = this.options.cwd ? __rspack_external_node_path_806ed179.relative(this.options.cwd, dir) : dir;
1220
1220
  const index = key || ONE_DOT;
1221
1221
  watchList[index] = entry.getChildren().sort();
1222
1222
  });
@@ -1229,8 +1229,8 @@ class FSWatcher extends EventEmitter {
1229
1229
  async _emit(event, path, stats) {
1230
1230
  if (this.closed) return;
1231
1231
  const opts = this.options;
1232
- if (isWindows) path = __rspack_external_node_path_c5b9b54f.normalize(path);
1233
- if (opts.cwd) path = __rspack_external_node_path_c5b9b54f.relative(opts.cwd, path);
1232
+ if (isWindows) path = __rspack_external_node_path_806ed179.normalize(path);
1233
+ if (opts.cwd) path = __rspack_external_node_path_806ed179.relative(opts.cwd, path);
1234
1234
  const args = [
1235
1235
  path
1236
1236
  ];
@@ -1281,7 +1281,7 @@ class FSWatcher extends EventEmitter {
1281
1281
  if (isThrottled) return this;
1282
1282
  }
1283
1283
  if (opts.alwaysStat && void 0 === stats && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
1284
- const fullPath = opts.cwd ? __rspack_external_node_path_c5b9b54f.join(opts.cwd, path) : path;
1284
+ const fullPath = opts.cwd ? __rspack_external_node_path_806ed179.join(opts.cwd, path) : path;
1285
1285
  let stats;
1286
1286
  try {
1287
1287
  stats = await promises_stat(fullPath);
@@ -1333,7 +1333,7 @@ class FSWatcher extends EventEmitter {
1333
1333
  const pollInterval = awf.pollInterval;
1334
1334
  let timeoutHandler;
1335
1335
  let fullPath = path;
1336
- if (this.options.cwd && !__rspack_external_node_path_c5b9b54f.isAbsolute(path)) fullPath = __rspack_external_node_path_c5b9b54f.join(this.options.cwd, path);
1336
+ if (this.options.cwd && !__rspack_external_node_path_806ed179.isAbsolute(path)) fullPath = __rspack_external_node_path_806ed179.join(this.options.cwd, path);
1337
1337
  const now = new Date();
1338
1338
  const writes = this._pendingWrites;
1339
1339
  function awaitWriteFinishFn(prevStat) {
@@ -1388,7 +1388,7 @@ class FSWatcher extends EventEmitter {
1388
1388
  return new WatchHelper(path, this.options.followSymlinks, this);
1389
1389
  }
1390
1390
  _getWatchedDir(directory) {
1391
- const dir = __rspack_external_node_path_c5b9b54f.resolve(directory);
1391
+ const dir = __rspack_external_node_path_806ed179.resolve(directory);
1392
1392
  if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove));
1393
1393
  return this._watched.get(dir);
1394
1394
  }
@@ -1397,8 +1397,8 @@ class FSWatcher extends EventEmitter {
1397
1397
  return Boolean(256 & Number(stats.mode));
1398
1398
  }
1399
1399
  _remove(directory, item, isDirectory) {
1400
- const path = __rspack_external_node_path_c5b9b54f.join(directory, item);
1401
- const fullPath = __rspack_external_node_path_c5b9b54f.resolve(path);
1400
+ const path = __rspack_external_node_path_806ed179.join(directory, item);
1401
+ const fullPath = __rspack_external_node_path_806ed179.resolve(path);
1402
1402
  isDirectory = null != isDirectory ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
1403
1403
  if (!this._throttle('remove', path, 100)) return;
1404
1404
  if (!isDirectory && 1 === this._watched.size) this.add(directory, item, true);
@@ -1410,7 +1410,7 @@ class FSWatcher extends EventEmitter {
1410
1410
  parent.remove(item);
1411
1411
  if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
1412
1412
  let relPath = path;
1413
- if (this.options.cwd) relPath = __rspack_external_node_path_c5b9b54f.relative(this.options.cwd, path);
1413
+ if (this.options.cwd) relPath = __rspack_external_node_path_806ed179.relative(this.options.cwd, path);
1414
1414
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
1415
1415
  const event = this._pendingWrites.get(relPath).cancelWait();
1416
1416
  if (event === EVENTS.ADD) return;
@@ -1423,8 +1423,8 @@ class FSWatcher extends EventEmitter {
1423
1423
  }
1424
1424
  _closePath(path) {
1425
1425
  this._closeFile(path);
1426
- const dir = __rspack_external_node_path_c5b9b54f.dirname(path);
1427
- this._getWatchedDir(dir).remove(__rspack_external_node_path_c5b9b54f.basename(path));
1426
+ const dir = __rspack_external_node_path_806ed179.dirname(path);
1427
+ this._getWatchedDir(dir).remove(__rspack_external_node_path_806ed179.basename(path));
1428
1428
  }
1429
1429
  _closeFile(path) {
1430
1430
  const closers = this._closers.get(path);
@@ -1,5 +1,5 @@
1
- import { __webpack_require__ } from "./944.js";
2
- import "./944.js";
1
+ import { __webpack_require__ } from "./619.js";
2
+ import "./619.js";
3
3
  __webpack_require__.add({
4
4
  "./node_modules/.pnpm/connect-history-api-fallback@2.0.0/node_modules/connect-history-api-fallback/lib/index.js" (module, exports, __webpack_require__) {
5
5
  var url = __webpack_require__("url?b918");
@@ -1,7 +1,7 @@
1
1
  /*! LICENSE: 0~connect-next.js.LICENSE.txt */
2
2
  import { EventEmitter } from "node:events";
3
3
  import { createRequire } from "node:module";
4
- import * as __rspack_external_node_http_2dc67212 from "node:http";
4
+ import * as __rspack_external_node_http_e245b239 from "node:http";
5
5
  /*! LICENSE: index.js.LICENSE.txt */ const __rspack_createRequire_require = createRequire(import.meta.url);
6
6
  var __webpack_modules__ = {};
7
7
  var __webpack_module_cache__ = {};
@@ -591,17 +591,17 @@ __nested_rspack_require_364__.add({
591
591
  return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
592
592
  }
593
593
  },
594
- "./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js" (module, __unused_rspack_exports, __nested_rspack_require_23493_23512__) {
594
+ "./node_modules/.pnpm/finalhandler@2.1.1_supports-color@8.1.1/node_modules/finalhandler/index.js" (module, __unused_rspack_exports, __nested_rspack_require_23514_23533__) {
595
595
  /*!
596
596
  * finalhandler
597
597
  * Copyright(c) 2014-2022 Douglas Christopher Wilson
598
598
  * MIT Licensed
599
- */ var debug = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('finalhandler');
600
- var encodeUrl = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js");
601
- var escapeHtml = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js");
602
- var onFinished = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js");
603
- var parseUrl = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js");
604
- var statuses = __nested_rspack_require_23493_23512__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js");
599
+ */ var debug = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js")('finalhandler');
600
+ var encodeUrl = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/encodeurl@2.0.0/node_modules/encodeurl/index.js");
601
+ var escapeHtml = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/escape-html@1.0.3/node_modules/escape-html/index.js");
602
+ var onFinished = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js");
603
+ var parseUrl = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js");
604
+ var statuses = __nested_rspack_require_23514_23533__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js");
605
605
  var isFinished = onFinished.isFinished;
606
606
  function createHtmlDocument(message) {
607
607
  var body = escapeHtml(message).replaceAll('\n', '<br>').replaceAll(' ', ' &nbsp;');
@@ -781,7 +781,7 @@ __nested_rspack_require_364__.add({
781
781
  return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
782
782
  }
783
783
  },
784
- "./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_rspack_exports, __nested_rspack_require_32097_32116__) {
784
+ "./node_modules/.pnpm/on-finished@2.4.1/node_modules/on-finished/index.js" (module, __unused_rspack_exports, __nested_rspack_require_32118_32137__) {
785
785
  /*!
786
786
  * on-finished
787
787
  * Copyright(c) 2013 Jonathan Ong
@@ -790,7 +790,7 @@ __nested_rspack_require_364__.add({
790
790
  */ module.exports = onFinished;
791
791
  module.exports.isFinished = isFinished;
792
792
  var asyncHooks = tryRequireAsyncHooks();
793
- var first = __nested_rspack_require_32097_32116__("./node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js");
793
+ var first = __nested_rspack_require_32118_32137__("./node_modules/.pnpm/ee-first@1.1.1/node_modules/ee-first/index.js");
794
794
  var defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
795
795
  process.nextTick(fn.bind.apply(fn, arguments));
796
796
  };
@@ -869,7 +869,7 @@ __nested_rspack_require_364__.add({
869
869
  }
870
870
  function tryRequireAsyncHooks() {
871
871
  try {
872
- return __nested_rspack_require_32097_32116__("async_hooks");
872
+ return __nested_rspack_require_32118_32137__("async_hooks");
873
873
  } catch (e) {
874
874
  return {};
875
875
  }
@@ -881,13 +881,13 @@ __nested_rspack_require_364__.add({
881
881
  return res.runInAsyncScope.bind(res, fn, null);
882
882
  }
883
883
  },
884
- "./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js" (module, __unused_rspack_exports, __nested_rspack_require_36017_36036__) {
884
+ "./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js" (module, __unused_rspack_exports, __nested_rspack_require_36038_36057__) {
885
885
  /*!
886
886
  * parseurl
887
887
  * Copyright(c) 2014 Jonathan Ong
888
888
  * Copyright(c) 2014-2017 Douglas Christopher Wilson
889
889
  * MIT Licensed
890
- */ var url = __nested_rspack_require_36017_36036__("url");
890
+ */ var url = __nested_rspack_require_36038_36057__("url");
891
891
  var parse = url.parse;
892
892
  var Url = url.Url;
893
893
  module.exports = parseurl;
@@ -947,13 +947,13 @@ __nested_rspack_require_364__.add({
947
947
  return 'object' == typeof parsedUrl && null !== parsedUrl && (void 0 === Url || parsedUrl instanceof Url) && parsedUrl._raw === url;
948
948
  }
949
949
  },
950
- "./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports, __nested_rspack_require_38488_38507__) {
950
+ "./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/index.js" (module, __unused_rspack_exports, __nested_rspack_require_38509_38528__) {
951
951
  /*!
952
952
  * statuses
953
953
  * Copyright(c) 2014 Jonathan Ong
954
954
  * Copyright(c) 2016 Douglas Christopher Wilson
955
955
  * MIT Licensed
956
- */ var codes = __nested_rspack_require_38488_38507__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json");
956
+ */ var codes = __nested_rspack_require_38509_38528__("./node_modules/.pnpm/statuses@2.0.2/node_modules/statuses/codes.json");
957
957
  module.exports = status;
958
958
  status.message = codes;
959
959
  status.code = createMessageToStatusCodeMap(codes);
@@ -1008,10 +1008,10 @@ __nested_rspack_require_364__.add({
1008
1008
  return getStatusCode(code);
1009
1009
  }
1010
1010
  },
1011
- "./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js" (module, __unused_rspack_exports, __nested_rspack_require_40780_40799__) {
1012
- const os = __nested_rspack_require_40780_40799__("os");
1013
- const tty = __nested_rspack_require_40780_40799__("tty");
1014
- const hasFlag = __nested_rspack_require_40780_40799__("./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
1011
+ "./node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js" (module, __unused_rspack_exports, __nested_rspack_require_40801_40820__) {
1012
+ const os = __nested_rspack_require_40801_40820__("os");
1013
+ const tty = __nested_rspack_require_40801_40820__("tty");
1014
+ const hasFlag = __nested_rspack_require_40801_40820__("./node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
1015
1015
  const { env } = process;
1016
1016
  let flagForceColor;
1017
1017
  if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
@@ -1115,7 +1115,7 @@ __nested_rspack_require_364__.add({
1115
1115
  });
1116
1116
  const src = __nested_rspack_require_364__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js");
1117
1117
  var src_default = /*#__PURE__*/ __nested_rspack_require_364__.n(src);
1118
- const dist_finalhandler = __nested_rspack_require_364__("./node_modules/.pnpm/finalhandler@2.1.1/node_modules/finalhandler/index.js");
1118
+ const dist_finalhandler = __nested_rspack_require_364__("./node_modules/.pnpm/finalhandler@2.1.1_supports-color@8.1.1/node_modules/finalhandler/index.js");
1119
1119
  var finalhandler_default = /*#__PURE__*/ __nested_rspack_require_364__.n(dist_finalhandler);
1120
1120
  const dist_parseurl = __nested_rspack_require_364__("./node_modules/.pnpm/parseurl@1.3.3/node_modules/parseurl/index.js");
1121
1121
  var parseurl_default = /*#__PURE__*/ __nested_rspack_require_364__.n(dist_parseurl);
@@ -1209,7 +1209,7 @@ const proto = {
1209
1209
  next();
1210
1210
  },
1211
1211
  listen (...args) {
1212
- const server = __rspack_external_node_http_2dc67212.createServer(this);
1212
+ const server = __rspack_external_node_http_e245b239.createServer(this);
1213
1213
  return server.listen(...args);
1214
1214
  }
1215
1215
  };
@@ -1219,13 +1219,29 @@ function call(handle, route, err, req, res, next) {
1219
1219
  const hasError = void 0 !== err;
1220
1220
  dist_debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
1221
1221
  try {
1222
- if (hasError && 4 === arity) return void handle(err, req, res, next);
1223
- if (!hasError && arity < 4) return void handle(req, res, next);
1222
+ if (hasError && 4 === arity) {
1223
+ const result = handle(err, req, res, next);
1224
+ handlePromise(result, next);
1225
+ return;
1226
+ }
1227
+ if (!hasError && arity < 4) {
1228
+ const result = handle(req, res, next);
1229
+ handlePromise(result, next);
1230
+ return;
1231
+ }
1224
1232
  } catch (caughtError) {
1225
1233
  error = caughtError;
1226
1234
  }
1227
1235
  next(error);
1228
1236
  }
1237
+ function isPromise(value) {
1238
+ return null !== value && ('object' == typeof value || 'function' == typeof value) && 'function' == typeof value.then;
1239
+ }
1240
+ function handlePromise(result, next) {
1241
+ if (isPromise(result)) result.then(null, (error)=>{
1242
+ next(error || new Error('Rejected promise'));
1243
+ });
1244
+ }
1229
1245
  function logerror(err) {
1230
1246
  if ('test' !== dist_env) {
1231
1247
  if (err instanceof Error) return void console.error(err.stack || err.toString());
@@ -1244,6 +1260,6 @@ function isConnectServer(value) {
1244
1260
  return 'function' == typeof value && 'handle' in value && 'function' == typeof value.handle;
1245
1261
  }
1246
1262
  function isHttpServer(value) {
1247
- return value instanceof __rspack_external_node_http_2dc67212.Server;
1263
+ return value instanceof __rspack_external_node_http_e245b239.Server;
1248
1264
  }
1249
1265
  export { connect };
package/dist/0~debug.js CHANGED
@@ -1,7 +1,7 @@
1
- import { __webpack_require__ } from "./944.js";
2
- import "./944.js";
1
+ import { __webpack_require__ } from "./619.js";
2
+ import "./619.js";
3
3
  __webpack_require__.add({
4
- "./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js" (module, exports, __webpack_require__) {
4
+ "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js" (module, exports, __webpack_require__) {
5
5
  exports.formatArgs = formatArgs;
6
6
  exports.save = save;
7
7
  exports.load = load;
@@ -134,7 +134,7 @@ __webpack_require__.add({
134
134
  return localStorage;
135
135
  } catch (error) {}
136
136
  }
137
- module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js")(exports);
137
+ module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
138
138
  const { formatters } = module.exports;
139
139
  formatters.j = function(v) {
140
140
  try {
@@ -144,7 +144,7 @@ __webpack_require__.add({
144
144
  }
145
145
  };
146
146
  },
147
- "./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __webpack_require__) {
147
+ "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js" (module, __unused_rspack_exports, __webpack_require__) {
148
148
  function setup(env) {
149
149
  createDebug.debug = createDebug;
150
150
  createDebug.default = createDebug;
@@ -286,11 +286,11 @@ __webpack_require__.add({
286
286
  }
287
287
  module.exports = setup;
288
288
  },
289
- "./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
290
- if ("u" < typeof process || 'renderer' === process.type || true === process.browser || process.__nwjs) module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js");
291
- else module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js");
289
+ "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
290
+ if ("u" < typeof process || 'renderer' === process.type || true === process.browser || process.__nwjs) module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js");
291
+ else module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js");
292
292
  },
293
- "./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js" (module, exports, __webpack_require__) {
293
+ "./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js" (module, exports, __webpack_require__) {
294
294
  const tty = __webpack_require__("tty");
295
295
  const util = __webpack_require__("util");
296
296
  exports.init = init;
@@ -428,7 +428,7 @@ __webpack_require__.add({
428
428
  const keys = Object.keys(exports.inspectOpts);
429
429
  for(let i = 0; i < keys.length; i++)debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
430
430
  }
431
- module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js")(exports);
431
+ module.exports = __webpack_require__("./node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js")(exports);
432
432
  const { formatters } = module.exports;
433
433
  formatters.o = function(v) {
434
434
  this.inspectOpts.colors = this.useColors;