mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-20 05:40:17 +08:00
- Complete frontend lowering with zero rejected statements, dynamic islands, or skipped functions. - Support contextual construction, presence guards, and union record copies used by the compiler. - Add native CommonJS resolution and cross-platform file URL handling while preserving Node host behavior.
15 lines
607 B
TypeScript
15 lines
607 B
TypeScript
import { readFileSync } from "node:fs";
|
|
import { cjsResolvePaths, resolveCjsRuntime } from "../../../packages/compiler/src/frontend/cjs-resolve.js";
|
|
|
|
interface Request {
|
|
from: string;
|
|
request: string;
|
|
paths: string[] | null;
|
|
lookup: boolean;
|
|
}
|
|
const requests = JSON.parse(readFileSync(process.argv[2]!, "utf8")) as Request[];
|
|
for (const request of requests) {
|
|
if (request.lookup) console.log(JSON.stringify(cjsResolvePaths(request.from, request.request)));
|
|
else console.log(JSON.stringify(resolveCjsRuntime(request.from, request.request, request.paths === null ? undefined : request.paths)));
|
|
}
|