Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handling of gh deps in noir_wasm #4499

Merged
merged 2 commits into from
Mar 7, 2024
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
7 changes: 6 additions & 1 deletion compiler/wasm/src/noir/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ export class Package {
handles
.filter((handle) => SOURCE_EXTENSIONS.find((ext) => handle.endsWith(ext)))
.map(async (file) => {
const suffix = file.replace(this.#srcPath, '');
// Github deps are directly added to the file manager, which causes them to be missing the absolute path to the source file
// and only include the extraction directory relative to the fm root directory
// This regexp ensures we remove the "real" source path for all dependencies, providing the compiler with what it expects for each source file:
// <absoluteSourcePath> -> <sourceAsString> for bin/contract packages
// <depAlias/relativePathToSource> -> <sourceAsString> for libs
const suffix = file.replace(new RegExp(`.*${this.#srcPath}`), '');
return {
path: this.getType() === 'lib' ? `${alias ? alias : this.#config.package.name}${suffix}` : file,
source: (await fm.readFile(file, 'utf-8')).toString(),
Expand Down
Loading