elit 3.1.6 → 3.1.7

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/server.mjs CHANGED
@@ -705,205 +705,205 @@ async function processDenoEntriesAsync(iterator, withFileTypes) {
705
705
  }
706
706
  return entries;
707
707
  }
708
- async function readFile(path, options) {
708
+ async function readFile(path2, options) {
709
709
  const opts = parseOptions(options, {});
710
710
  if (isNode) {
711
- return fsPromises.readFile(path, opts);
711
+ return fsPromises.readFile(path2, opts);
712
712
  } else if (isBun) {
713
- const file = Bun.file(path);
713
+ const file = Bun.file(path2);
714
714
  const content = await file.arrayBuffer();
715
715
  return decodeContent(content, opts.encoding);
716
716
  } else if (isDeno) {
717
- const content = await Deno.readFile(path);
717
+ const content = await Deno.readFile(path2);
718
718
  return decodeContent(content, opts.encoding);
719
719
  }
720
720
  throw new Error("Unsupported runtime");
721
721
  }
722
- function readFileSync(path, options) {
722
+ function readFileSync(path2, options) {
723
723
  const opts = parseOptions(options, {});
724
724
  if (isNode) {
725
- return fs.readFileSync(path, opts);
725
+ return fs.readFileSync(path2, opts);
726
726
  } else if (isBun) {
727
- const file = Bun.file(path);
727
+ const file = Bun.file(path2);
728
728
  const content = file.arrayBuffer();
729
729
  return decodeContent(content, opts.encoding);
730
730
  } else if (isDeno) {
731
- const content = Deno.readFileSync(path);
731
+ const content = Deno.readFileSync(path2);
732
732
  return decodeContent(content, opts.encoding);
733
733
  }
734
734
  throw new Error("Unsupported runtime");
735
735
  }
736
- async function writeFile(path, data, options) {
736
+ async function writeFile(path2, data, options) {
737
737
  const opts = parseOptions(options, {});
738
738
  if (isNode) {
739
- return fsPromises.writeFile(path, data, opts);
739
+ return fsPromises.writeFile(path2, data, opts);
740
740
  } else if (isBun) {
741
- await Bun.write(path, data);
741
+ await Bun.write(path2, data);
742
742
  } else if (isDeno) {
743
- await Deno.writeFile(path, dataToUint8Array(data));
743
+ await Deno.writeFile(path2, dataToUint8Array(data));
744
744
  }
745
745
  }
746
- function writeFileSync(path, data, options) {
746
+ function writeFileSync(path2, data, options) {
747
747
  const opts = parseOptions(options, {});
748
748
  if (isNode) {
749
- fs.writeFileSync(path, data, opts);
749
+ fs.writeFileSync(path2, data, opts);
750
750
  } else if (isBun) {
751
- Bun.write(path, data);
751
+ Bun.write(path2, data);
752
752
  } else if (isDeno) {
753
- Deno.writeFileSync(path, dataToUint8Array(data));
753
+ Deno.writeFileSync(path2, dataToUint8Array(data));
754
754
  }
755
755
  }
756
- async function appendFile(path, data, options) {
756
+ async function appendFile(path2, data, options) {
757
757
  const opts = parseOptions(options, {});
758
758
  if (isNode) {
759
- return fsPromises.appendFile(path, data, opts);
759
+ return fsPromises.appendFile(path2, data, opts);
760
760
  } else {
761
- if (await exists(path)) {
762
- const existing = await readFile(path);
761
+ if (await exists(path2)) {
762
+ const existing = await readFile(path2);
763
763
  const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
764
- await writeFile(path, combined, opts);
764
+ await writeFile(path2, combined, opts);
765
765
  } else {
766
- await writeFile(path, data, opts);
766
+ await writeFile(path2, data, opts);
767
767
  }
768
768
  }
769
769
  }
770
- function appendFileSync(path, data, options) {
770
+ function appendFileSync(path2, data, options) {
771
771
  const opts = parseOptions(options, {});
772
772
  if (isNode) {
773
- fs.appendFileSync(path, data, opts);
773
+ fs.appendFileSync(path2, data, opts);
774
774
  } else {
775
- if (existsSync(path)) {
776
- const existing = readFileSync(path);
775
+ if (existsSync(path2)) {
776
+ const existing = readFileSync(path2);
777
777
  const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
778
- writeFileSync(path, combined, opts);
778
+ writeFileSync(path2, combined, opts);
779
779
  } else {
780
- writeFileSync(path, data, opts);
780
+ writeFileSync(path2, data, opts);
781
781
  }
782
782
  }
783
783
  }
784
- async function exists(path) {
784
+ async function exists(path2) {
785
785
  try {
786
- await stat(path);
786
+ await stat(path2);
787
787
  return true;
788
788
  } catch {
789
789
  return false;
790
790
  }
791
791
  }
792
- function existsSync(path) {
792
+ function existsSync(path2) {
793
793
  try {
794
- statSync(path);
794
+ statSync(path2);
795
795
  return true;
796
796
  } catch {
797
797
  return false;
798
798
  }
799
799
  }
800
- async function stat(path) {
800
+ async function stat(path2) {
801
801
  if (isNode) {
802
- return fsPromises.stat(path);
802
+ return fsPromises.stat(path2);
803
803
  } else if (isBun) {
804
- const file = Bun.file(path);
804
+ const file = Bun.file(path2);
805
805
  const size = file.size;
806
806
  const exists2 = await file.exists();
807
807
  if (!exists2) {
808
- throw new Error(`ENOENT: no such file or directory, stat '${path}'`);
808
+ throw new Error(`ENOENT: no such file or directory, stat '${path2}'`);
809
809
  }
810
- return createStatsObject(path, size, false);
810
+ return createStatsObject(path2, size, false);
811
811
  } else if (isDeno) {
812
- const info = await Deno.stat(path);
812
+ const info = await Deno.stat(path2);
813
813
  return createStatsFromDenoFileInfo(info);
814
814
  }
815
815
  throw new Error("Unsupported runtime");
816
816
  }
817
- function statSync(path) {
817
+ function statSync(path2) {
818
818
  if (isNode) {
819
- return fs.statSync(path);
819
+ return fs.statSync(path2);
820
820
  } else if (isBun) {
821
- const file = Bun.file(path);
821
+ const file = Bun.file(path2);
822
822
  const size = file.size;
823
823
  try {
824
824
  file.arrayBuffer();
825
825
  } catch {
826
- throw new Error(`ENOENT: no such file or directory, stat '${path}'`);
826
+ throw new Error(`ENOENT: no such file or directory, stat '${path2}'`);
827
827
  }
828
- return createStatsObject(path, size, false);
828
+ return createStatsObject(path2, size, false);
829
829
  } else if (isDeno) {
830
- const info = Deno.statSync(path);
830
+ const info = Deno.statSync(path2);
831
831
  return createStatsFromDenoFileInfo(info);
832
832
  }
833
833
  throw new Error("Unsupported runtime");
834
834
  }
835
- async function mkdir(path, options) {
835
+ async function mkdir(path2, options) {
836
836
  const opts = typeof options === "number" ? { mode: options } : options || {};
837
837
  if (isNode) {
838
- await fsPromises.mkdir(path, opts);
838
+ await fsPromises.mkdir(path2, opts);
839
839
  } else if (isBun) {
840
- await Deno.mkdir(path, { recursive: opts.recursive });
840
+ await Deno.mkdir(path2, { recursive: opts.recursive });
841
841
  } else if (isDeno) {
842
- await Deno.mkdir(path, { recursive: opts.recursive });
842
+ await Deno.mkdir(path2, { recursive: opts.recursive });
843
843
  }
844
844
  }
845
- function mkdirSync(path, options) {
845
+ function mkdirSync(path2, options) {
846
846
  const opts = typeof options === "number" ? { mode: options } : options || {};
847
847
  if (isNode) {
848
- fs.mkdirSync(path, opts);
848
+ fs.mkdirSync(path2, opts);
849
849
  } else if (isBun) {
850
- Deno.mkdirSync(path, { recursive: opts.recursive });
850
+ Deno.mkdirSync(path2, { recursive: opts.recursive });
851
851
  } else if (isDeno) {
852
- Deno.mkdirSync(path, { recursive: opts.recursive });
852
+ Deno.mkdirSync(path2, { recursive: opts.recursive });
853
853
  }
854
854
  }
855
- async function readdir(path, options) {
855
+ async function readdir(path2, options) {
856
856
  const opts = parseOptions(options, {});
857
857
  if (isNode) {
858
- return fsPromises.readdir(path, opts);
858
+ return fsPromises.readdir(path2, opts);
859
859
  } else if (isBunOrDeno) {
860
- return processDenoEntriesAsync(Deno.readDir(path), opts.withFileTypes);
860
+ return processDenoEntriesAsync(Deno.readDir(path2), opts.withFileTypes);
861
861
  }
862
862
  throw new Error("Unsupported runtime");
863
863
  }
864
- function readdirSync(path, options) {
864
+ function readdirSync(path2, options) {
865
865
  const opts = parseOptions(options, {});
866
866
  if (isNode) {
867
- return fs.readdirSync(path, opts);
867
+ return fs.readdirSync(path2, opts);
868
868
  } else if (isBunOrDeno) {
869
- return processDenoEntries(Deno.readDirSync(path), opts.withFileTypes);
869
+ return processDenoEntries(Deno.readDirSync(path2), opts.withFileTypes);
870
870
  }
871
871
  throw new Error("Unsupported runtime");
872
872
  }
873
- async function unlink(path) {
873
+ async function unlink(path2) {
874
874
  if (isNode) {
875
- return fsPromises.unlink(path);
875
+ return fsPromises.unlink(path2);
876
876
  } else if (isBun) {
877
- await Deno.remove(path);
877
+ await Deno.remove(path2);
878
878
  } else if (isDeno) {
879
- await Deno.remove(path);
879
+ await Deno.remove(path2);
880
880
  }
881
881
  }
882
- function unlinkSync(path) {
882
+ function unlinkSync(path2) {
883
883
  if (isNode) {
884
- fs.unlinkSync(path);
884
+ fs.unlinkSync(path2);
885
885
  } else if (isBun) {
886
- Deno.removeSync(path);
886
+ Deno.removeSync(path2);
887
887
  } else if (isDeno) {
888
- Deno.removeSync(path);
888
+ Deno.removeSync(path2);
889
889
  }
890
890
  }
891
- async function rmdir(path, options) {
891
+ async function rmdir(path2, options) {
892
892
  if (isNode) {
893
- return fsPromises.rmdir(path, options);
893
+ return fsPromises.rmdir(path2, options);
894
894
  } else if (isBun) {
895
- await Deno.remove(path, { recursive: options?.recursive });
895
+ await Deno.remove(path2, { recursive: options?.recursive });
896
896
  } else if (isDeno) {
897
- await Deno.remove(path, { recursive: options?.recursive });
897
+ await Deno.remove(path2, { recursive: options?.recursive });
898
898
  }
899
899
  }
900
- function rmdirSync(path, options) {
900
+ function rmdirSync(path2, options) {
901
901
  if (isNode) {
902
- fs.rmdirSync(path, options);
902
+ fs.rmdirSync(path2, options);
903
903
  } else if (isBun) {
904
- Deno.removeSync(path, { recursive: options?.recursive });
904
+ Deno.removeSync(path2, { recursive: options?.recursive });
905
905
  } else if (isDeno) {
906
- Deno.removeSync(path, { recursive: options?.recursive });
906
+ Deno.removeSync(path2, { recursive: options?.recursive });
907
907
  }
908
908
  }
909
909
  async function rename(oldPath, newPath) {
@@ -942,27 +942,27 @@ function copyFileSync(src, dest, flags) {
942
942
  Deno.copyFileSync(src, dest);
943
943
  }
944
944
  }
945
- async function realpath(path, options) {
945
+ async function realpath(path2, options) {
946
946
  if (isNode) {
947
- return fsPromises.realpath(path, options);
947
+ return fsPromises.realpath(path2, options);
948
948
  } else if (isBun) {
949
- const fs2 = __require("fs/promises");
950
- return fs2.realpath(path, options);
949
+ const fs3 = __require("fs/promises");
950
+ return fs3.realpath(path2, options);
951
951
  } else if (isDeno) {
952
- return await Deno.realPath(path);
952
+ return await Deno.realPath(path2);
953
953
  }
954
- return path;
954
+ return path2;
955
955
  }
956
- function realpathSync(path, options) {
956
+ function realpathSync(path2, options) {
957
957
  if (isNode) {
958
- return fs.realpathSync(path, options);
958
+ return fs.realpathSync(path2, options);
959
959
  } else if (isBun) {
960
- const fs2 = __require("fs");
961
- return fs2.realpathSync(path, options);
960
+ const fs3 = __require("fs");
961
+ return fs3.realpathSync(path2, options);
962
962
  } else if (isDeno) {
963
- return Deno.realPathSync(path);
963
+ return Deno.realPathSync(path2);
964
964
  }
965
- return path;
965
+ return path2;
966
966
  }
967
967
  function createStatsObject(_path, size, isDir) {
968
968
  const now = Date.now();
@@ -1477,32 +1477,32 @@ var WebSocketServer = class extends EventEmitter3 {
1477
1477
  // src/chokidar.ts
1478
1478
  init_runtime();
1479
1479
  import { EventEmitter as EventEmitter4 } from "events";
1480
- function normalizePath(path) {
1481
- return path.replace(/\\/g, "/");
1480
+ function normalizePath(path2) {
1481
+ return path2.replace(/\\/g, "/");
1482
1482
  }
1483
- function emitEvent(watcher, eventType, path) {
1484
- watcher.emit(eventType, path);
1485
- watcher.emit("all", eventType, path);
1483
+ function emitEvent(watcher, eventType, path2) {
1484
+ watcher.emit(eventType, path2);
1485
+ watcher.emit("all", eventType, path2);
1486
1486
  }
1487
- function matchesAnyPattern(path, patterns) {
1488
- return patterns.some((pattern) => matchesPattern(path, pattern));
1487
+ function matchesAnyPattern(path2, patterns) {
1488
+ return patterns.some((pattern) => matchesPattern(path2, pattern));
1489
1489
  }
1490
- function handleRenameEvent(watcher, fullPath, fs2) {
1490
+ function handleRenameEvent(watcher, fullPath, fs3) {
1491
1491
  try {
1492
- fs2.statSync(fullPath);
1492
+ fs3.statSync(fullPath);
1493
1493
  emitEvent(watcher, "add", fullPath);
1494
1494
  } catch {
1495
1495
  emitEvent(watcher, "unlink", fullPath);
1496
1496
  }
1497
1497
  }
1498
- function setupFsWatch(watcher, baseDir, patterns, fs2) {
1498
+ function setupFsWatch(watcher, baseDir, patterns, fs3) {
1499
1499
  try {
1500
- const nativeWatcher = fs2.watch(baseDir, { recursive: true }, (eventType, filename) => {
1500
+ const nativeWatcher = fs3.watch(baseDir, { recursive: true }, (eventType, filename) => {
1501
1501
  if (!filename) return;
1502
1502
  const fullPath = normalizePath(`${baseDir}/${filename}`);
1503
1503
  if (!matchesAnyPattern(fullPath, patterns)) return;
1504
1504
  if (eventType === "rename") {
1505
- handleRenameEvent(watcher, fullPath, fs2);
1505
+ handleRenameEvent(watcher, fullPath, fs3);
1506
1506
  } else if (eventType === "change") {
1507
1507
  emitEvent(watcher, "change", fullPath);
1508
1508
  }
@@ -1534,7 +1534,7 @@ var FSWatcher = class extends EventEmitter4 {
1534
1534
  this._watcher.add(pathArray);
1535
1535
  }
1536
1536
  } else {
1537
- pathArray.forEach((path) => this._watched.add(path));
1537
+ pathArray.forEach((path2) => this._watched.add(path2));
1538
1538
  }
1539
1539
  return this;
1540
1540
  }
@@ -1551,7 +1551,7 @@ var FSWatcher = class extends EventEmitter4 {
1551
1551
  this._watcher.unwatch(pathArray);
1552
1552
  }
1553
1553
  } else {
1554
- pathArray.forEach((path) => this._watched.delete(path));
1554
+ pathArray.forEach((path2) => this._watched.delete(path2));
1555
1555
  }
1556
1556
  return this;
1557
1557
  }
@@ -1578,9 +1578,9 @@ var FSWatcher = class extends EventEmitter4 {
1578
1578
  return this._watcher.getWatched();
1579
1579
  }
1580
1580
  const result = {};
1581
- this._watched.forEach((path) => {
1582
- const dir = path.substring(0, path.lastIndexOf("/")) || ".";
1583
- const file = path.substring(path.lastIndexOf("/") + 1);
1581
+ this._watched.forEach((path2) => {
1582
+ const dir = path2.substring(0, path2.lastIndexOf("/")) || ".";
1583
+ const file = path2.substring(path2.lastIndexOf("/") + 1);
1584
1584
  if (!result[dir]) {
1585
1585
  result[dir] = [];
1586
1586
  }
@@ -1617,19 +1617,19 @@ function watch(paths, options) {
1617
1617
  const watcher = new FSWatcher(options);
1618
1618
  const pathArray = Array.isArray(paths) ? paths : [paths];
1619
1619
  const watchMap = /* @__PURE__ */ new Map();
1620
- pathArray.forEach((path) => {
1621
- const baseDir = getBaseDirectory(path);
1620
+ pathArray.forEach((path2) => {
1621
+ const baseDir = getBaseDirectory(path2);
1622
1622
  if (!watchMap.has(baseDir)) {
1623
1623
  watchMap.set(baseDir, []);
1624
1624
  }
1625
- watchMap.get(baseDir).push(path);
1625
+ watchMap.get(baseDir).push(path2);
1626
1626
  });
1627
1627
  if (runtime === "node") {
1628
- const fs2 = __require("fs");
1629
- watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs2));
1628
+ const fs3 = __require("fs");
1629
+ watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs3));
1630
1630
  } else if (runtime === "bun") {
1631
- const fs2 = __require("fs");
1632
- watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs2));
1631
+ const fs3 = __require("fs");
1632
+ watchMap.forEach((patterns, baseDir) => setupFsWatch(watcher, baseDir, patterns, fs3));
1633
1633
  } else if (runtime === "deno") {
1634
1634
  const baseDirs = Array.from(watchMap.keys());
1635
1635
  const allPatterns = Array.from(watchMap.values()).flat();
@@ -1638,18 +1638,18 @@ function watch(paths, options) {
1638
1638
  const denoWatcher = Deno.watchFs(baseDirs);
1639
1639
  for await (const event of denoWatcher) {
1640
1640
  if (watcher["_closed"]) break;
1641
- for (const path of event.paths) {
1642
- const normalizedPath = normalizePath(path);
1641
+ for (const path2 of event.paths) {
1642
+ const normalizedPath = normalizePath(path2);
1643
1643
  if (!matchesAnyPattern(normalizedPath, allPatterns)) continue;
1644
1644
  switch (event.kind) {
1645
1645
  case "create":
1646
- emitEvent(watcher, "add", path);
1646
+ emitEvent(watcher, "add", path2);
1647
1647
  break;
1648
1648
  case "modify":
1649
- emitEvent(watcher, "change", path);
1649
+ emitEvent(watcher, "change", path2);
1650
1650
  break;
1651
1651
  case "remove":
1652
- emitEvent(watcher, "unlink", path);
1652
+ emitEvent(watcher, "unlink", path2);
1653
1653
  break;
1654
1654
  }
1655
1655
  }
@@ -1660,7 +1660,7 @@ function watch(paths, options) {
1660
1660
  }
1661
1661
  }
1662
1662
  })();
1663
- pathArray.forEach((path) => watcher.add(path));
1663
+ pathArray.forEach((path2) => watcher.add(path2));
1664
1664
  queueMicrotask(() => watcher.emit("ready"));
1665
1665
  }
1666
1666
  return watcher;
@@ -1682,38 +1682,38 @@ function getCwd() {
1682
1682
  }
1683
1683
  return "/";
1684
1684
  }
1685
- function findLastSeparator(path) {
1686
- return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
1685
+ function findLastSeparator(path2) {
1686
+ return Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\"));
1687
1687
  }
1688
1688
  function createPathOps(isWin) {
1689
1689
  return {
1690
1690
  sep: getSeparator(isWin),
1691
1691
  delimiter: isWin ? ";" : ":",
1692
- normalize: (path) => normalizePath2(path, isWin),
1692
+ normalize: (path2) => normalizePath2(path2, isWin),
1693
1693
  join: (...paths) => joinPaths(paths, isWin),
1694
1694
  resolve: (...paths) => resolvePaths(paths, isWin),
1695
- isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
1695
+ isAbsolute: (path2) => isWin ? isAbsoluteWin(path2) : isAbsolutePosix(path2),
1696
1696
  relative: (from, to) => relativePath(from, to, isWin),
1697
- dirname: (path) => getDirname(path, isWin),
1698
- basename: (path, ext) => getBasename(path, ext, isWin),
1699
- extname: (path) => getExtname(path),
1700
- parse: (path) => parsePath(path, isWin),
1697
+ dirname: (path2) => getDirname(path2, isWin),
1698
+ basename: (path2, ext) => getBasename(path2, ext, isWin),
1699
+ extname: (path2) => getExtname(path2),
1700
+ parse: (path2) => parsePath(path2, isWin),
1701
1701
  format: (pathObject) => formatPath(pathObject, isWin)
1702
1702
  };
1703
1703
  }
1704
- function isAbsolutePosix(path) {
1705
- return path.length > 0 && path[0] === "/";
1704
+ function isAbsolutePosix(path2) {
1705
+ return path2.length > 0 && path2[0] === "/";
1706
1706
  }
1707
- function isAbsoluteWin(path) {
1708
- const len = path.length;
1707
+ function isAbsoluteWin(path2) {
1708
+ const len = path2.length;
1709
1709
  if (len === 0) return false;
1710
- const code = path.charCodeAt(0);
1710
+ const code = path2.charCodeAt(0);
1711
1711
  if (code === 47 || code === 92) {
1712
1712
  return true;
1713
1713
  }
1714
1714
  if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
1715
- if (len > 2 && path.charCodeAt(1) === 58) {
1716
- const code2 = path.charCodeAt(2);
1715
+ if (len > 2 && path2.charCodeAt(1) === 58) {
1716
+ const code2 = path2.charCodeAt(2);
1717
1717
  if (code2 === 47 || code2 === 92) {
1718
1718
  return true;
1719
1719
  }
@@ -1732,12 +1732,12 @@ var isWindows = (() => {
1732
1732
  var sep = isWindows ? "\\" : "/";
1733
1733
  var posix = createPathOps(false);
1734
1734
  var win32 = createPathOps(true);
1735
- function normalizePath2(path, isWin) {
1736
- if (path.length === 0) return ".";
1735
+ function normalizePath2(path2, isWin) {
1736
+ if (path2.length === 0) return ".";
1737
1737
  const separator = getSeparator(isWin);
1738
- const isAbsolute = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
1739
- const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
1740
- let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
1738
+ const isAbsolute = isWin ? isAbsoluteWin(path2) : isAbsolutePosix(path2);
1739
+ const trailingSeparator = path2[path2.length - 1] === separator || isWin && path2[path2.length - 1] === "/";
1740
+ let normalized = path2.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
1741
1741
  const parts = normalized.split(separator);
1742
1742
  const result = [];
1743
1743
  for (let i = 0; i < parts.length; i++) {
@@ -1772,12 +1772,12 @@ function joinPaths(paths, isWin) {
1772
1772
  const separator = getSeparator(isWin);
1773
1773
  let joined = "";
1774
1774
  for (let i = 0; i < paths.length; i++) {
1775
- const path = paths[i];
1776
- if (path && path.length > 0) {
1775
+ const path2 = paths[i];
1776
+ if (path2 && path2.length > 0) {
1777
1777
  if (joined.length === 0) {
1778
- joined = path;
1778
+ joined = path2;
1779
1779
  } else {
1780
- joined += separator + path;
1780
+ joined += separator + path2;
1781
1781
  }
1782
1782
  }
1783
1783
  }
@@ -1789,9 +1789,9 @@ function resolvePaths(paths, isWin) {
1789
1789
  let resolved = "";
1790
1790
  let isAbsolute = false;
1791
1791
  for (let i = paths.length - 1; i >= 0 && !isAbsolute; i--) {
1792
- const path = paths[i];
1793
- if (path && path.length > 0) {
1794
- resolved = path + (resolved.length > 0 ? separator + resolved : "");
1792
+ const path2 = paths[i];
1793
+ if (path2 && path2.length > 0) {
1794
+ resolved = path2 + (resolved.length > 0 ? separator + resolved : "");
1795
1795
  isAbsolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
1796
1796
  }
1797
1797
  }
@@ -1827,51 +1827,51 @@ function relativePath(from, to, isWin) {
1827
1827
  }
1828
1828
  return result.join(separator) || ".";
1829
1829
  }
1830
- function getDirname(path, isWin) {
1831
- if (path.length === 0) return ".";
1830
+ function getDirname(path2, isWin) {
1831
+ if (path2.length === 0) return ".";
1832
1832
  const separator = getSeparator(isWin);
1833
- const normalized = normalizePath2(path, isWin);
1833
+ const normalized = normalizePath2(path2, isWin);
1834
1834
  const lastSepIndex = normalized.lastIndexOf(separator);
1835
1835
  if (lastSepIndex === -1) return ".";
1836
1836
  if (lastSepIndex === 0) return separator;
1837
1837
  return normalized.slice(0, lastSepIndex);
1838
1838
  }
1839
- function getBasename(path, ext, isWin) {
1840
- if (path.length === 0) return "";
1841
- const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
1842
- let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
1839
+ function getBasename(path2, ext, isWin) {
1840
+ if (path2.length === 0) return "";
1841
+ const lastSepIndex = isWin ? findLastSeparator(path2) : path2.lastIndexOf("/");
1842
+ let base = lastSepIndex === -1 ? path2 : path2.slice(lastSepIndex + 1);
1843
1843
  if (ext && base.endsWith(ext)) {
1844
1844
  base = base.slice(0, base.length - ext.length);
1845
1845
  }
1846
1846
  return base;
1847
1847
  }
1848
- function getExtname(path) {
1849
- const lastDotIndex = path.lastIndexOf(".");
1850
- const lastSepIndex = findLastSeparator(path);
1851
- if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
1848
+ function getExtname(path2) {
1849
+ const lastDotIndex = path2.lastIndexOf(".");
1850
+ const lastSepIndex = findLastSeparator(path2);
1851
+ if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path2.length - 1) {
1852
1852
  return "";
1853
1853
  }
1854
- return path.slice(lastDotIndex);
1854
+ return path2.slice(lastDotIndex);
1855
1855
  }
1856
- function parsePath(path, isWin) {
1856
+ function parsePath(path2, isWin) {
1857
1857
  let root = "";
1858
1858
  if (isWin) {
1859
- if (path.length >= 2 && path[1] === ":") {
1860
- root = path.slice(0, 2);
1861
- if (path.length > 2 && (path[2] === "\\" || path[2] === "/")) {
1859
+ if (path2.length >= 2 && path2[1] === ":") {
1860
+ root = path2.slice(0, 2);
1861
+ if (path2.length > 2 && (path2[2] === "\\" || path2[2] === "/")) {
1862
1862
  root += "\\";
1863
1863
  }
1864
- } else if (path[0] === "\\" || path[0] === "/") {
1864
+ } else if (path2[0] === "\\" || path2[0] === "/") {
1865
1865
  root = "\\";
1866
1866
  }
1867
1867
  } else {
1868
- if (path[0] === "/") {
1868
+ if (path2[0] === "/") {
1869
1869
  root = "/";
1870
1870
  }
1871
1871
  }
1872
- const dir = getDirname(path, isWin);
1873
- const base = getBasename(path, void 0, isWin);
1874
- const ext = getExtname(path);
1872
+ const dir = getDirname(path2, isWin);
1873
+ const base = getBasename(path2, void 0, isWin);
1874
+ const ext = getExtname(path2);
1875
1875
  const name = ext ? base.slice(0, base.length - ext.length) : base;
1876
1876
  return { root, dir, base, ext, name };
1877
1877
  }
@@ -1883,8 +1883,8 @@ function formatPath(pathObject, isWin) {
1883
1883
  if (dir === pathObject.root) return dir + base;
1884
1884
  return dir + separator + base;
1885
1885
  }
1886
- function normalize(path) {
1887
- return normalizePath2(path, isWindows);
1886
+ function normalize(path2) {
1887
+ return normalizePath2(path2, isWindows);
1888
1888
  }
1889
1889
  function join(...paths) {
1890
1890
  return joinPaths(paths, isWindows);
@@ -1895,8 +1895,8 @@ function resolve(...paths) {
1895
1895
  function relative(from, to) {
1896
1896
  return relativePath(from, to, isWindows);
1897
1897
  }
1898
- function extname(path) {
1899
- return getExtname(path);
1898
+ function extname(path2) {
1899
+ return getExtname(path2);
1900
1900
  }
1901
1901
 
1902
1902
  // src/mime-types.ts
@@ -1979,12 +1979,12 @@ for (const ext in MIME_TYPES) {
1979
1979
  }
1980
1980
  TYPE_TO_EXTENSIONS[type].push(ext);
1981
1981
  }
1982
- function getExtension(path) {
1983
- const match = /\.([^./\\]+)$/.exec(path);
1982
+ function getExtension(path2) {
1983
+ const match = /\.([^./\\]+)$/.exec(path2);
1984
1984
  return match ? match[1].toLowerCase() : "";
1985
1985
  }
1986
- function lookup(path) {
1987
- const ext = getExtension(path) || path.toLowerCase();
1986
+ function lookup(path2) {
1987
+ const ext = getExtension(path2) || path2.toLowerCase();
1988
1988
  return MIME_TYPES[ext] || false;
1989
1989
  }
1990
1990
 
@@ -2631,29 +2631,169 @@ var dom = new DomNode();
2631
2631
  var render = dom.render.bind(dom);
2632
2632
  var renderToString = dom.renderToString.bind(dom);
2633
2633
 
2634
+ // src/database.ts
2635
+ import vm from "vm";
2636
+ import path from "path";
2637
+ import fs2 from "fs";
2638
+ import * as esbuild from "esbuild";
2639
+ var Database = class {
2640
+ constructor(config) {
2641
+ this._config = {
2642
+ dir: resolve(process.cwd(), "databases")
2643
+ };
2644
+ this._config = { ...this._config, ...config };
2645
+ this._registerModules = config.registerModules || {};
2646
+ this._ctx = vm.createContext(this._registerModules);
2647
+ }
2648
+ set config(config) {
2649
+ this._config = { ...this._config, ...config };
2650
+ }
2651
+ register(context) {
2652
+ this._registerModules = { ...this._registerModules, ...context };
2653
+ this._ctx = vm.createContext(this._registerModules);
2654
+ }
2655
+ plugin(moduleName, moduleContent) {
2656
+ this.register({ [moduleName]: moduleContent });
2657
+ }
2658
+ resolvePath(fileList, query) {
2659
+ const aliases = { "@db": this._config.dir || resolve(process.cwd(), "databases") };
2660
+ let resolvedPath = query;
2661
+ for (const [alias, target] of Object.entries(aliases)) {
2662
+ if (resolvedPath.startsWith(alias + "/")) {
2663
+ resolvedPath = resolvedPath.replace(alias, target);
2664
+ break;
2665
+ }
2666
+ }
2667
+ resolvedPath = path.normalize(resolvedPath);
2668
+ return fileList.find((file) => {
2669
+ const normalizedFile = path.normalize(file);
2670
+ const fileWithoutExt = normalizedFile.replace(/\.[^/.]+$/, "");
2671
+ return normalizedFile === resolvedPath || fileWithoutExt === resolvedPath || normalizedFile === resolvedPath + ".ts" || normalizedFile === resolvedPath + ".js";
2672
+ });
2673
+ }
2674
+ async moduleLinker(specifier, referencingModule) {
2675
+ const dbFiles = fs2.readdirSync(this._config.dir || resolve(process.cwd(), "databases")).filter((f) => f.endsWith(".ts")).map((f) => path.join(this._config.dir || resolve(process.cwd(), "databases"), f));
2676
+ const dbResult = this.resolvePath(dbFiles, specifier);
2677
+ if (dbResult) {
2678
+ try {
2679
+ const actualModule = await import(dbResult);
2680
+ const exportNames = Object.keys(actualModule);
2681
+ return new vm.SyntheticModule(
2682
+ exportNames,
2683
+ function() {
2684
+ exportNames.forEach((key) => {
2685
+ this.setExport(key, actualModule[key]);
2686
+ });
2687
+ },
2688
+ { identifier: specifier, context: referencingModule.context }
2689
+ );
2690
+ } catch (err) {
2691
+ console.error(`Failed to load database module ${specifier}:`, err);
2692
+ throw err;
2693
+ }
2694
+ }
2695
+ throw new Error(`Module ${specifier} is not allowed or not found.`);
2696
+ }
2697
+ async vmRun(code, _options) {
2698
+ const logs = [];
2699
+ const customConsole = ["log", "error", "warn", "info", "debug", "trace"].reduce((acc, type) => {
2700
+ acc[type] = (...args) => logs.push({ type, args });
2701
+ return acc;
2702
+ }, {});
2703
+ this.register({
2704
+ console: customConsole
2705
+ });
2706
+ let stringCode;
2707
+ if (typeof code === "function") {
2708
+ const funcStr = code.toString();
2709
+ const arrowMatch = funcStr.match(/^[\s]*\(?\s*\)?\s*=>\s*{?/);
2710
+ const functionMatch = funcStr.match(/^[\s]*function\s*\(?[\w\s]*\)?\s*{/);
2711
+ const match = arrowMatch || functionMatch;
2712
+ const start = match ? match[0].length : 0;
2713
+ const end = funcStr.lastIndexOf("}");
2714
+ stringCode = funcStr.substring(start, end);
2715
+ stringCode = stringCode.replace(/^[\s\r\n]+/, "").replace(/[\s\r\n]+$/, "");
2716
+ stringCode = stringCode.replace(
2717
+ /import\s*\(\s*([^)]+?)\s*\)\s*\.from\s*\(\s*(['"])([^'"]+)\2\s*\)/g,
2718
+ (_, importArg, quote, modulePath) => {
2719
+ const trimmed = importArg.trim();
2720
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
2721
+ const inner = trimmed.slice(1, -1).trim();
2722
+ return `import { ${inner} } from ${quote}${modulePath}${quote}`;
2723
+ } else {
2724
+ return `import ${trimmed} from ${quote}${modulePath}${quote}`;
2725
+ }
2726
+ }
2727
+ );
2728
+ stringCode = stringCode.split("\n").map((line) => line.trim()).join("\n").trim();
2729
+ } else {
2730
+ stringCode = code;
2731
+ }
2732
+ const result = await esbuild.build({
2733
+ stdin: {
2734
+ contents: stringCode,
2735
+ loader: this._config.language || "ts"
2736
+ },
2737
+ format: "esm",
2738
+ target: "es2020",
2739
+ write: false,
2740
+ bundle: false,
2741
+ sourcemap: false
2742
+ });
2743
+ const js = result.outputFiles[0].text;
2744
+ const mod = new vm.SourceTextModule(js, { context: this._ctx, identifier: path.join(this._config.dir || resolve(process.cwd(), "databases"), "virtual-entry.js") });
2745
+ await mod.link(this.moduleLinker.bind(this));
2746
+ await mod.evaluate();
2747
+ return {
2748
+ namespace: mod.namespace,
2749
+ logs
2750
+ };
2751
+ }
2752
+ /**
2753
+ * Execute database code and return results
2754
+ */
2755
+ async execute(code, options) {
2756
+ return await this.vmRun(code, options);
2757
+ }
2758
+ };
2759
+ var database = serverDatabase.database;
2760
+
2634
2761
  // src/server.ts
2762
+ var ServerDatabase = class {
2763
+ constructor() {
2764
+ this._db = null;
2765
+ }
2766
+ async initialize(config) {
2767
+ this._db = new Database(config);
2768
+ }
2769
+ database() {
2770
+ return this._db;
2771
+ }
2772
+ };
2773
+ var serverDatabase = new ServerDatabase();
2774
+ var database2 = serverDatabase.database;
2635
2775
  var ServerRouter = class {
2636
2776
  constructor() {
2637
2777
  this.routes = [];
2638
2778
  this.middlewares = [];
2639
2779
  // Express-like .all() method - matches all HTTP methods
2640
- this.all = (path, ...handlers) => this.addRoute("ALL", path, handlers);
2780
+ this.all = (path2, ...handlers) => this.addRoute("ALL", path2, handlers);
2641
2781
  // Support per-route middleware: accept middleware(s) before the final handler
2642
- this.get = (path, ...handlers) => this.addRoute("GET", path, handlers);
2643
- this.post = (path, ...handlers) => this.addRoute("POST", path, handlers);
2644
- this.put = (path, ...handlers) => this.addRoute("PUT", path, handlers);
2645
- this.delete = (path, ...handlers) => this.addRoute("DELETE", path, handlers);
2646
- this.patch = (path, ...handlers) => this.addRoute("PATCH", path, handlers);
2647
- this.options = (path, ...handlers) => this.addRoute("OPTIONS", path, handlers);
2648
- this.head = (path, ...handlers) => this.addRoute("HEAD", path, handlers);
2782
+ this.get = (path2, ...handlers) => this.addRoute("GET", path2, handlers);
2783
+ this.post = (path2, ...handlers) => this.addRoute("POST", path2, handlers);
2784
+ this.put = (path2, ...handlers) => this.addRoute("PUT", path2, handlers);
2785
+ this.delete = (path2, ...handlers) => this.addRoute("DELETE", path2, handlers);
2786
+ this.patch = (path2, ...handlers) => this.addRoute("PATCH", path2, handlers);
2787
+ this.options = (path2, ...handlers) => this.addRoute("OPTIONS", path2, handlers);
2788
+ this.head = (path2, ...handlers) => this.addRoute("HEAD", path2, handlers);
2649
2789
  }
2650
2790
  // Accept both internal Middleware and Express-style `(req, res, next?)` functions
2651
2791
  // Also support path-based middleware like Express: use(path, middleware)
2652
2792
  use(...args) {
2653
2793
  if (typeof args[0] === "string") {
2654
- const path = args[0];
2794
+ const path2 = args[0];
2655
2795
  const middlewares = args.slice(1);
2656
- return this.addRoute("ALL", path, middlewares);
2796
+ return this.addRoute("ALL", path2, middlewares);
2657
2797
  }
2658
2798
  const mw = args[0];
2659
2799
  this.middlewares.push(this.toMiddleware(mw));
@@ -2684,8 +2824,8 @@ var ServerRouter = class {
2684
2824
  await next();
2685
2825
  };
2686
2826
  }
2687
- addRoute(method, path, handlers) {
2688
- const { pattern, paramNames } = this.pathToRegex(path);
2827
+ addRoute(method, path2, handlers) {
2828
+ const { pattern, paramNames } = this.pathToRegex(path2);
2689
2829
  if (!handlers || handlers.length === 0) throw new Error("Route must include a handler");
2690
2830
  const rawMiddlewares = handlers.slice(0, handlers.length - 1);
2691
2831
  const rawLast = handlers[handlers.length - 1];
@@ -2714,9 +2854,9 @@ var ServerRouter = class {
2714
2854
  this.routes.push({ method, pattern, paramNames, handler: last, middlewares });
2715
2855
  return this;
2716
2856
  }
2717
- pathToRegex(path) {
2857
+ pathToRegex(path2) {
2718
2858
  const paramNames = [];
2719
- const pattern = path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\//g, "\\/").replace(/:(\w+)/g, (_, name) => (paramNames.push(name), "([^\\/]+)"));
2859
+ const pattern = path2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\//g, "\\/").replace(/:(\w+)/g, (_, name) => (paramNames.push(name), "([^\\/]+)"));
2720
2860
  return { pattern: new RegExp(`^${pattern}$`), paramNames };
2721
2861
  }
2722
2862
  parseQuery(url) {
@@ -2774,11 +2914,11 @@ var ServerRouter = class {
2774
2914
  });
2775
2915
  }
2776
2916
  async handle(req, res) {
2777
- const method = req.method, url = req.url || "/", path = url.split("?")[0];
2917
+ const method = req.method, url = req.url || "/", path2 = url.split("?")[0];
2778
2918
  for (const route of this.routes) {
2779
2919
  if (route.method !== "ALL" && route.method !== method) continue;
2780
- if (!route.pattern.test(path)) continue;
2781
- const match = path.match(route.pattern);
2920
+ if (!route.pattern.test(path2)) continue;
2921
+ const match = path2.match(route.pattern);
2782
2922
  const params = Object.fromEntries(route.paramNames.map((name, i2) => [name, match[i2 + 1]]));
2783
2923
  let body = {};
2784
2924
  if (["POST", "PUT", "PATCH"].includes(method)) {
@@ -3236,21 +3376,21 @@ function security() {
3236
3376
  await next();
3237
3377
  };
3238
3378
  }
3239
- function rewritePath(path, pathRewrite) {
3240
- if (!pathRewrite) return path;
3379
+ function rewritePath(path2, pathRewrite) {
3380
+ if (!pathRewrite) return path2;
3241
3381
  for (const [from, to] of Object.entries(pathRewrite)) {
3242
3382
  const regex = new RegExp(from);
3243
- if (regex.test(path)) {
3244
- return path.replace(regex, to);
3383
+ if (regex.test(path2)) {
3384
+ return path2.replace(regex, to);
3245
3385
  }
3246
3386
  }
3247
- return path;
3387
+ return path2;
3248
3388
  }
3249
3389
  function createProxyHandler(proxyConfigs) {
3250
3390
  return async (req, res) => {
3251
3391
  const url = req.url || "/";
3252
- const path = url.split("?")[0];
3253
- const proxy = proxyConfigs.find((p) => path.startsWith(p.context));
3392
+ const path2 = url.split("?")[0];
3393
+ const proxy = proxyConfigs.find((p) => path2.startsWith(p.context));
3254
3394
  if (!proxy) return false;
3255
3395
  const { target, changeOrigin, pathRewrite, headers } = proxy;
3256
3396
  try {
@@ -3302,7 +3442,7 @@ function createProxyHandler(proxyConfigs) {
3302
3442
  req.on("end", () => proxyReq.end());
3303
3443
  return true;
3304
3444
  } catch (error) {
3305
- console.error("[Proxy] Invalid proxy configuration for %s:", path, error);
3445
+ console.error("[Proxy] Invalid proxy configuration for %s:", path2, error);
3306
3446
  return false;
3307
3447
  }
3308
3448
  };
@@ -3423,6 +3563,9 @@ function createDevServer(options) {
3423
3563
  if (config.mode === "dev") {
3424
3564
  clearImportMapCache();
3425
3565
  }
3566
+ if (config.database) {
3567
+ serverDatabase.initialize(config.database);
3568
+ }
3426
3569
  const clientsToNormalize = config.clients?.length ? config.clients : config.root ? [{ root: config.root, basePath: config.basePath || "", index: config.index, ssr: config.ssr, api: config.api, proxy: config.proxy, mode: config.mode }] : null;
3427
3570
  if (!clientsToNormalize) throw new Error('DevServerOptions must include either "clients" array or "root" directory');
3428
3571
  const normalizedClients = clientsToNormalize.map((client) => {
@@ -3452,6 +3595,17 @@ function createDevServer(options) {
3452
3595
  const globalProxyHandler = config.proxy ? createProxyHandler(config.proxy) : null;
3453
3596
  const server = createServer(async (req, res) => {
3454
3597
  const originalUrl = req.url || "/";
3598
+ const hostHeader = req.headers.host;
3599
+ const hostName = hostHeader ? (Array.isArray(hostHeader) ? hostHeader[0] : hostHeader).split(":")[0] : "";
3600
+ if (config.domain && hostName === (config.host || "localhost")) {
3601
+ const redirectUrl = `http://${config.domain}${originalUrl}`;
3602
+ if (config.logging) {
3603
+ console.log(`[Domain Map] ${hostName}:${config.port}${originalUrl} -> ${redirectUrl}`);
3604
+ }
3605
+ res.writeHead(302, { Location: redirectUrl });
3606
+ res.end();
3607
+ return;
3608
+ }
3455
3609
  const matchedClient = normalizedClients.find((c) => c.basePath && originalUrl.startsWith(c.basePath)) || normalizedClients.find((c) => !c.basePath);
3456
3610
  if (!matchedClient) return send404(res, "404 Not Found");
3457
3611
  if (matchedClient.proxyHandler) {
@@ -3703,8 +3857,8 @@ export default css;
3703
3857
  });
3704
3858
  transpiled = transpiler.transformSync(content.toString());
3705
3859
  } else {
3706
- const { build } = await import("esbuild");
3707
- const result = await build({
3860
+ const { build: build2 } = await import("esbuild");
3861
+ const result = await build2({
3708
3862
  stdin: {
3709
3863
  contents: content.toString(),
3710
3864
  loader: ext === ".tsx" ? "tsx" : "ts",
@@ -3721,19 +3875,19 @@ export default css;
3721
3875
  }
3722
3876
  transpiled = transpiled.replace(
3723
3877
  /from\s+["']([^"']+)\.ts(x?)["']/g,
3724
- (_, path, tsx) => `from "${path}.js${tsx}"`
3878
+ (_, path2, tsx) => `from "${path2}.js${tsx}"`
3725
3879
  );
3726
3880
  transpiled = transpiled.replace(
3727
3881
  /import\s+["']([^"']+)\.ts(x?)["']/g,
3728
- (_, path, tsx) => `import "${path}.js${tsx}"`
3882
+ (_, path2, tsx) => `import "${path2}.js${tsx}"`
3729
3883
  );
3730
3884
  transpiled = transpiled.replace(
3731
3885
  /import\s+["']([^"']+\.css)["']/g,
3732
- (_, path) => `import "${path}?inline"`
3886
+ (_, path2) => `import "${path2}?inline"`
3733
3887
  );
3734
3888
  transpiled = transpiled.replace(
3735
3889
  /from\s+["']([^"']+\.css)["']/g,
3736
- (_, path) => `from "${path}?inline"`
3890
+ (_, path2) => `from "${path2}?inline"`
3737
3891
  );
3738
3892
  content = Buffer.from(transpiled);
3739
3893
  mimeType = "application/javascript";
@@ -3895,17 +4049,17 @@ ${elitImportMap}` : elitImportMap;
3895
4049
  (client) => config.watch.map((pattern) => join(client.root, pattern))
3896
4050
  );
3897
4051
  const watcher = watch(watchPaths, {
3898
- ignored: (path) => config.ignore.some((pattern) => path.includes(pattern.replace("/**", "").replace("**/", ""))),
4052
+ ignored: (path2) => config.ignore.some((pattern) => path2.includes(pattern.replace("/**", "").replace("**/", ""))),
3899
4053
  ignoreInitial: true,
3900
4054
  persistent: true
3901
4055
  });
3902
- watcher.on("change", (path) => {
3903
- if (config.logging) console.log(`[HMR] File changed: ${path}`);
3904
- const message = JSON.stringify({ type: "update", path, timestamp: Date.now() });
4056
+ watcher.on("change", (path2) => {
4057
+ if (config.logging) console.log(`[HMR] File changed: ${path2}`);
4058
+ const message = JSON.stringify({ type: "update", path: path2, timestamp: Date.now() });
3905
4059
  wsClients.forEach((client) => client.readyState === 1 /* OPEN */ && client.send(message));
3906
4060
  });
3907
- watcher.on("add", (path) => config.logging && console.log(`[HMR] File added: ${path}`));
3908
- watcher.on("unlink", (path) => config.logging && console.log(`[HMR] File removed: ${path}`));
4061
+ watcher.on("add", (path2) => config.logging && console.log(`[HMR] File added: ${path2}`));
4062
+ watcher.on("unlink", (path2) => config.logging && console.log(`[HMR] File removed: ${path2}`));
3909
4063
  server.setMaxListeners(20);
3910
4064
  server.listen(config.port, config.host, () => {
3911
4065
  if (config.logging) {
@@ -3977,12 +4131,14 @@ export {
3977
4131
  cors,
3978
4132
  createDevServer,
3979
4133
  createProxyHandler,
4134
+ database2 as database,
3980
4135
  errorHandler,
3981
4136
  html,
3982
4137
  json,
3983
4138
  logger,
3984
4139
  rateLimit,
3985
4140
  security,
4141
+ serverDatabase,
3986
4142
  status,
3987
4143
  text
3988
4144
  };