tina4-nodejs 3.13.162 → 3.13.164

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.
@@ -68,12 +68,15 @@ function readCliVersion(): string {
68
68
  * message is printed; takeover is also skipped in a container, outside dev mode,
69
69
  * and when opted out (`TINA4_NO_TAKEOVER` / `tina4 serve --no-kill`).
70
70
  *
71
+ * `host` is the address serve will bind; a port that binds there is reported
72
+ * as free, not "in use".
73
+ *
71
74
  * Returns true only when a Tina4 holder was actually signalled.
72
75
  */
73
- async function killProcessOnPort(port: number): Promise<boolean> {
76
+ async function killProcessOnPort(port: number, host?: string): Promise<boolean> {
74
77
  const { takeOverPort, isDev, noTakeoverOptedOut, TAKEOVER_KILLED, TAKEOVER_REFUSALS } =
75
78
  await import("../../core/src/portTakeover.js");
76
- const result = takeOverPort(port, isDev(), noTakeoverOptedOut());
79
+ const result = takeOverPort(port, isDev(), noTakeoverOptedOut(), undefined, undefined, host);
77
80
  if (result.status === TAKEOVER_KILLED) {
78
81
  console.log(` ${result.message}`);
79
82
  return true;
@@ -359,7 +362,9 @@ export const COMMANDS: Record<string, CommandSpec> = {
359
362
  // path here AND the runtime bind-failure fallback both honour it
360
363
  // (TAKEOVER-DEC-03).
361
364
  if (a.includes("--no-kill")) process.env.TINA4_NO_TAKEOVER = "true";
362
- await killProcessOnPort(port);
365
+ // Probe the host the server will bind, resolved exactly as it resolves it.
366
+ const { resolvePortAndHost } = await import("../../core/src/server.js");
367
+ await killProcessOnPort(port, resolvePortAndHost({ port }).host);
363
368
  await serveProject({ port, noBrowser, noReload });
364
369
  },
365
370
  flags: SERVE_FLAGS,
@@ -57,7 +57,7 @@ async function runInlineTests(cwd: string): Promise<boolean> {
57
57
  const srcDir = resolve(cwd, "src");
58
58
  if (!existsSync(srcDir)) return false;
59
59
 
60
- const { runAll, reset } = await import("@tina4/core");
60
+ const { runAllAsync, reset } = await import("@tina4/core");
61
61
  reset();
62
62
 
63
63
  let discovered = 0;
@@ -81,7 +81,7 @@ async function runInlineTests(cwd: string): Promise<boolean> {
81
81
 
82
82
  if (discovered === 0) return false;
83
83
 
84
- const results = runAll();
84
+ const results = await runAllAsync();
85
85
  return results.failed + results.errors > 0;
86
86
  }
87
87