WIP bundled noir_wasm + source resolver#3781
Closed
signorecello wants to merge 4 commits intomasterfrom
Closed
Conversation
Member
|
I think you're aware already but we're making big changes to the wasm compiler atm so we should hold off on this for a bit. |
Contributor
Author
|
Yes I'm part of that discussion actually, this PR is mostly to provide some context for @Thunkar |
5 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jan 11, 2024
…ger` for consistency with native interface (#3891) # Description Merging the work done here: AztecProtocol/aztec-packages#3696 #3781 #3760 Plus some extras to make the API nicer. ## Problem Closes(?) #3695 ## Summary Makes noir_wasm easier to work with, including dependency resolution and bundling. This package can be used from both node and the browser with identical API leveraging a virtual filesystem. Uses webpack for bundling, which is done in two steps: 1) rust -> wasm (cjs/esm) 2) TS + wasm (cjs/esm) -> universal package for web Tests have been migrated to mocha and playwright. ## Additional Context ~~I really want to test it [here](https://github.com/signorecello/noir-playground) before merging, but it's in a state in which it can be reviewed before we commit to an API.~~ Done: signorecello/noir-playground#32 Even though the initial memFS-backed FileManager developed by @alexghr is still here, it is not used for the web version due to import problems. The way it works now, webpack uses `memfs` directly it to alias the node `fs` module (which seems to be its intended use case) and allows us to use the nodejs `fs` API everywhere. ## Documentation Documentation is required for usage, but should basically be: ```typescript // Node.js import { compile, createFileManager } from '@noir-lang/noir_wasm'; // Rename!! const fm = createFileManager(myProjectPath); const myCompiledCode = await compile(fm); ``` ```typescript // Browser import { compile, createFileManager } from '@noir-lang/noir_wasm'; // Rename!! const fm = createFileManager('/'); for (const path of files) { await fm.writeFile(path, await getFileAsStream(path)); } const myCompiledCode = await compile(fm); ``` Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --------- Co-authored-by: sirasistant <sirasistant@gmail.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com> Co-authored-by: Tom French <tom@tomfren.ch>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a WIP on bundling and supporting multi target for noir_wasm, obviously don’t merge