fix(core): correct WAAPI rediscovery seek baselines and preview reuse invalidation

This commit is contained in:
func25
2026-05-25 17:51:47 +07:00
parent 68fce93a49
commit e10ec358f8
7 changed files with 287 additions and 16 deletions
+14 -1
View File
@@ -99,6 +99,7 @@ interface HyperframesConfigResponse {
isHyperframes: boolean;
projectName: string;
projectDir: string;
serverBuildSignature?: string | null;
version: string;
}
@@ -114,6 +115,7 @@ export type DetectionResult =
export function detectHyperframesServer(
port: number,
normalizedProjectDir: string,
expectedServerBuildSignature: string | null = null,
): Promise<DetectionResult> {
return new Promise<DetectionResult>((resolveResult) => {
const req = http.get(
@@ -152,6 +154,12 @@ export function detectHyperframesServer(
const normalize = (p: string) => resolve(p).replace(/\\/g, "/").toLowerCase();
if (normalize(json.projectDir) === normalizedProjectDir) {
if (
expectedServerBuildSignature !== null &&
json.serverBuildSignature !== expectedServerBuildSignature
) {
return resolveResult({ type: "mismatch", projectName: json.projectName });
}
return resolveResult({ type: "match" });
}
@@ -327,6 +335,7 @@ export async function findPortAndServe(
startPort: number,
projectDir: string,
forceNew: boolean,
expectedServerBuildSignature: string | null = null,
): Promise<FindPortResult> {
const { createAdaptorServer } = await import("@hono/node-server");
const normalizedDir = resolve(projectDir).replace(/\\/g, "/").toLowerCase();
@@ -366,7 +375,11 @@ export async function findPortAndServe(
// Port is occupied — probe for existing HyperFrames instance
if (!forceNew) {
const detection = await detectHyperframesServer(port, normalizedDir);
const detection = await detectHyperframesServer(
port,
normalizedDir,
expectedServerBuildSignature,
);
if (detection.type === "match") {
return { type: "already-running", port };
}