Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik committed Dec 13, 2024
1 parent 5bd878c commit cc6d943
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions crates/solidity/outputs/npm/tests/src/compilation/common.mts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import fs from "node:fs/promises";
import path from "node:path";
import assert from "node:assert";

import { CompilationBuilder } from "@nomicfoundation/slang/compilation";
import { readRepoFile } from "../utils/files.mjs";

export async function createBuilder(): Promise<CompilationBuilder> {
const inputsDir = await readRepoFile("crates/solidity/outputs/npm/tests/src/compilation/inputs");

const builder = CompilationBuilder.create({
languageVersion: "0.8.0",

readFile: async (fileId) => {
const filePath = path.resolve(inputsDir, fileId);
return fs.readFile(filePath, "utf8");
return readRepoFile("crates/solidity/outputs/npm/tests/src/compilation/inputs", fileId);
},

resolveImport: async (sourceFileId, importPath) => {
Expand All @@ -22,7 +17,7 @@ export async function createBuilder(): Promise<CompilationBuilder> {
assert(importLiteral.endsWith('"'));

const importString = importLiteral.slice(1, -1);
return path.resolve(inputsDir, sourceFileId, "..", importString);
return path.join(sourceFileId, "..", importString);
},
});

Expand Down

0 comments on commit cc6d943

Please sign in to comment.