Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions evals/browser/lib/scaffold-case.mjs
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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}`;
}

Expand Down
Loading