mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
* feat: support wasm32-wasi as a production target - Add production LLVM WASI codegen with a 32-bit ABI, coroutines, and dynamic modules - Integrate WASI builds and execution into the CLI with capability diagnostics - Add differential coverage and document the fourth production target Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com> * fix: address wasm target review findings * fix WASI guest paths and fetch alias detection * fix WASI async bridge and fetch detection --------- Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com>
27 lines
909 B
TypeScript
27 lines
909 B
TypeScript
import { expect, test } from "vitest";
|
|
import { wasiGuestPath } from "../src/wasi-paths.js";
|
|
|
|
test("WASI guest paths follow the cwd and temp preopens", () => {
|
|
expect(wasiGuestPath("/work/repo/tests/main.cjs", "/work/repo", "/host/tmp", "posix"))
|
|
.toBe("/tests/main.cjs");
|
|
expect(wasiGuestPath("/host/tmp/build/main.cjs", "/work/repo", "/host/tmp", "posix"))
|
|
.toBe("/tmp/build/main.cjs");
|
|
expect(wasiGuestPath("/opt/source/main.cjs", "/work/repo", "/host/tmp", "posix"))
|
|
.toBeNull();
|
|
});
|
|
|
|
test("WASI guest paths normalize Windows host separators", () => {
|
|
expect(wasiGuestPath(
|
|
"C:\\work\\repo\\tests\\main.cjs",
|
|
"C:\\work\\repo",
|
|
"C:\\Users\\runner\\Temp",
|
|
"win32",
|
|
)).toBe("/tests/main.cjs");
|
|
expect(wasiGuestPath(
|
|
"C:\\Users\\runner\\Temp\\build\\main.cjs",
|
|
"C:\\work\\repo",
|
|
"C:\\Users\\runner\\Temp",
|
|
"win32",
|
|
)).toBe("/tmp/build/main.cjs");
|
|
});
|