mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(core): correct WAAPI rediscovery seek baselines and preview reuse invalidation
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user