@tsed/cli 7.5.0-rc.3 → 7.5.0-rc.4

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.
@@ -40,6 +40,10 @@ async function createViteDevServer() {
40
40
  const { createServer } = await import("vite");
41
41
  return createServer({
42
42
  configFile: normalizePath("vite.config.ts"),
43
+ optimizeDeps: {
44
+ noDiscovery: true,
45
+ include: []
46
+ },
43
47
  server: {
44
48
  middlewareMode: true,
45
49
  hmr: false,
@@ -63,9 +67,14 @@ async function runViteController(rawArgs) {
63
67
  const watch = parseWatchValue(rawArgs);
64
68
  const vite = await createViteDevServer();
65
69
  let childProcess;
70
+ let childStarted = false;
66
71
  let restarting = false;
67
72
  let queued = false;
68
73
  const startChild = () => {
74
+ if (childStarted) {
75
+ return;
76
+ }
77
+ childStarted = true;
69
78
  const cliEntry = process.argv[1];
70
79
  childProcess = spawn(process.execPath, cliEntry ? [cliEntry, "dev", ...rawArgs] : [runnerFile, ...rawArgs], {
71
80
  env: {
@@ -74,15 +83,22 @@ async function runViteController(rawArgs) {
74
83
  },
75
84
  stdio: "inherit"
76
85
  });
86
+ childProcess.once("exit", () => {
87
+ childStarted = false;
88
+ childProcess = undefined;
89
+ });
77
90
  };
78
91
  const stopChild = async () => {
79
- if (!childProcess || childProcess.killed) {
92
+ if (!childProcess || childProcess.killed || childProcess.exitCode !== null || childProcess.signalCode !== null) {
93
+ childStarted = false;
94
+ childProcess = undefined;
80
95
  return;
81
96
  }
82
97
  await new Promise((resolve) => {
83
98
  childProcess.once("exit", resolve);
84
99
  childProcess.kill("SIGTERM");
85
100
  });
101
+ childStarted = false;
86
102
  };
87
103
  const restartChild = async (reason, file = "") => {
88
104
  if (restarting) {
@@ -110,9 +126,7 @@ async function runViteController(rawArgs) {
110
126
  }
111
127
  });
112
128
  }
113
- vite.watcher.once("ready", () => {
114
- startChild();
115
- });
129
+ startChild();
116
130
  const shutdown = async () => {
117
131
  await stopChild();
118
132
  await vite.close();