From f26995f2637b57f5554c95e1bb0ff2f87fcca888 Mon Sep 17 00:00:00 2001 From: legend91019 <15853153143@163.com> Date: Sat, 17 Oct 2026 19:06:15 +0800 Subject: [PATCH] fix(evals): support cross-drive scaffold imports on Windows --- evals/browser/lib/scaffold-case.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/evals/browser/lib/scaffold-case.mjs b/evals/browser/lib/scaffold-case.mjs index 85ca3467b..b4a9a2119 100644 --- a/evals/browser/lib/scaffold-case.mjs +++ b/evals/browser/lib/scaffold-case.mjs @@ -1,5 +1,6 @@ import { mkdir, realpath, stat, writeFile } from "node:fs/promises"; -import { join, relative, sep } from "node:path"; +import { isAbsolute, join, relative, sep } from "node:path"; +import { pathToFileURL } from "node:url"; import { casesDirectory, evalDirectory } from "./paths.mjs"; @@ -16,9 +17,10 @@ async function exists(path) { } async function moduleSpecifier(fromDirectory, target) { - const path = relative(await realpath(fromDirectory), await realpath(target)) - .split(sep) - .join("/"); + const targetPath = await realpath(target); + const relativePath = relative(await realpath(fromDirectory), targetPath); + if (isAbsolute(relativePath)) return pathToFileURL(targetPath).href; + const path = relativePath.split(sep).join("/"); return path.startsWith(".") ? path : `./${path}`; }