nitro-nightly 3.0.1-20251224-090424-fb6b85d0 → 3.0.1-20251230-132916-74f2198d

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.
@@ -403,7 +403,7 @@ function nitroPreviewPlugin(ctx) {
403
403
  consola$1.info(`Spawning preview server...`);
404
404
  consola$1.info(buildInfo.commands?.preview);
405
405
  console.log("");
406
- const { getRandomPort } = await import("get-port-please");
406
+ const { getRandomPort, waitForPort } = await import("get-port-please");
407
407
  const randomPort = await getRandomPort();
408
408
  const child = spawn(command, args, {
409
409
  stdio: "inherit",
@@ -414,14 +414,18 @@ function nitroPreviewPlugin(ctx) {
414
414
  PORT: String(randomPort)
415
415
  }
416
416
  });
417
+ const killChild = (signal) => {
418
+ if (child && !child.killed) child.kill(signal);
419
+ };
417
420
  for (const sig of ["SIGINT", "SIGHUP"]) process.once(sig, () => {
418
421
  consola$1.info(`Stopping preview server...`);
419
- if (child.killed === false) {
420
- child.kill(sig);
421
- process.exit();
422
- }
422
+ killChild(sig);
423
+ process.exit();
423
424
  });
424
- child.on("exit", (code) => {
425
+ server.httpServer.once("close", () => {
426
+ killChild("SIGTERM");
427
+ });
428
+ child.once("exit", (code) => {
425
429
  if (code && code !== 0) consola$1.error(`[nitro] Preview server exited with code ${code}`);
426
430
  });
427
431
  const { createProxyServer } = await import("../cli/_chunks/dist3.mjs");
@@ -430,6 +434,10 @@ function nitroPreviewPlugin(ctx) {
430
434
  if (child && !child.killed) proxy.web(req, res).catch(next);
431
435
  else res.end(`Nitro preview server is not running.`);
432
436
  });
437
+ await waitForPort(randomPort, {
438
+ retries: 20,
439
+ delay: 500
440
+ });
433
441
  }
434
442
  };
435
443
  }
@@ -1,4 +1,4 @@
1
- // Based on https://github.com/hi-ogawa/vite-plugins/blob/main/packages/fullstack/types/query.d.ts
1
+ // Based on https://github.com/hi-ogawa/vite-plugin-fullstack/blob/main/types/query.d.ts
2
2
 
3
3
  type ImportAssetsResult = ImportAssetsResultRaw & {
4
4
  merge(...args: ImportAssetsResultRaw[]): ImportAssetsResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251224-090424-fb6b85d0",
3
+ "version": "3.0.1-20251230-132916-74f2198d",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",