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

New compiler, project support #32

Merged
merged 6 commits into from
Mar 21, 2024

Conversation

Thunkar
Copy link
Contributor

@Thunkar Thunkar commented Jan 5, 2024

Pending merge of: noir-lang/noir#3891

Dirty POC with project support, including virtual FS, dependency resolution, simplified WASM initialization and proper async compilation.

Screenshot 2024-01-05 at 23 25 54

Copy link

netlify bot commented Jan 5, 2024

Deploy Preview for noir-playground ready!

Name Link
🔨 Latest commit cd64ea8
🔍 Latest deploy log https://app.netlify.com/sites/noir-playground/deploys/65fc4d78ac638e0008c4e4c5
😎 Deploy Preview https://deploy-preview-32--noir-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

github-merge-queue bot pushed a commit to noir-lang/noir 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>
@signorecello signorecello marked this pull request as ready for review March 21, 2024 14:59
@signorecello signorecello merged commit 1c5269f into signorecello:main Mar 21, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants