@tsed/cli 7.5.0-rc.2 → 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,25 +67,38 @@ 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 = () => {
69
- childProcess = spawn(process.execPath, [runnerFile, ...rawArgs], {
74
+ if (childStarted) {
75
+ return;
76
+ }
77
+ childStarted = true;
78
+ const cliEntry = process.argv[1];
79
+ childProcess = spawn(process.execPath, cliEntry ? [cliEntry, "dev", ...rawArgs] : [runnerFile, ...rawArgs], {
70
80
  env: {
71
81
  ...process.env,
72
82
  [RUN_MODE]: "app"
73
83
  },
74
84
  stdio: "inherit"
75
85
  });
86
+ childProcess.once("exit", () => {
87
+ childStarted = false;
88
+ childProcess = undefined;
89
+ });
76
90
  };
77
91
  const stopChild = async () => {
78
- if (!childProcess || childProcess.killed) {
92
+ if (!childProcess || childProcess.killed || childProcess.exitCode !== null || childProcess.signalCode !== null) {
93
+ childStarted = false;
94
+ childProcess = undefined;
79
95
  return;
80
96
  }
81
97
  await new Promise((resolve) => {
82
98
  childProcess.once("exit", resolve);
83
99
  childProcess.kill("SIGTERM");
84
100
  });
101
+ childStarted = false;
85
102
  };
86
103
  const restartChild = async (reason, file = "") => {
87
104
  if (restarting) {
@@ -109,9 +126,7 @@ async function runViteController(rawArgs) {
109
126
  }
110
127
  });
111
128
  }
112
- vite.watcher.once("ready", () => {
113
- startChild();
114
- });
129
+ startChild();
115
130
  const shutdown = async () => {
116
131
  await stopChild();
117
132
  await vite.close();