Skip to content

Commit d5f93a0

Browse files
committed
Noir Boilerplate
1 parent b24a1a0 commit d5f93a0

File tree

11 files changed

+293
-0
lines changed

11 files changed

+293
-0
lines changed

apps/noir-compiler/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../.eslintrc.json",
3+
}

apps/noir-compiler/project.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "noir-compiler",
3+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "apps/noir-compiler/src",
5+
"projectType": "application",
6+
"implicitDependencies": [],
7+
"targets": {
8+
"build": {
9+
"executor": "@nrwl/webpack:webpack",
10+
"outputs": ["{options.outputPath}"],
11+
"defaultConfiguration": "development",
12+
"options": {
13+
"compiler": "babel",
14+
"outputPath": "dist/apps/noir-compiler",
15+
"index": "apps/noir-compiler/src/index.html",
16+
"baseHref": "./",
17+
"main": "apps/noir-compiler/src/main.tsx",
18+
"polyfills": "apps/noir-compiler/src/polyfills.ts",
19+
"tsConfig": "apps/noir-compiler/tsconfig.app.json",
20+
"assets": ["apps/noir-compiler/src/profile.json", "apps/noir-compiler/src/snarkjs.min.js"],
21+
"styles": ["apps/noir-compiler/src/css/app.css"],
22+
"scripts": [],
23+
"webpackConfig": "apps/noir-compiler/webpack.config.js"
24+
},
25+
"configurations": {
26+
"development": {
27+
},
28+
"production": {
29+
"fileReplacements": [
30+
{
31+
"replace": "apps/noir-compiler/src/environments/environment.ts",
32+
"with": "apps/noir-compiler/src/environments/environment.prod.ts"
33+
}
34+
]
35+
}
36+
}
37+
},
38+
"lint": {
39+
"executor": "@nrwl/linter:eslint",
40+
"outputs": ["{options.outputFile}"],
41+
"options": {
42+
"lintFilePatterns": ["apps/noir-compiler/**/*.ts"],
43+
"eslintConfig": "apps/noir-compiler/.eslintrc"
44+
}
45+
},
46+
"serve": {
47+
"executor": "@nrwl/webpack:dev-server",
48+
"defaultConfiguration": "development",
49+
"options": {
50+
"buildTarget": "noir-compiler:build",
51+
"hmr": true,
52+
"baseHref": "/"
53+
},
54+
"configurations": {
55+
"development": {
56+
"buildTarget": "noir-compiler:build:development",
57+
"port": 2023
58+
},
59+
"production": {
60+
"buildTarget": "noir-compiler:build:production"
61+
}
62+
}
63+
}
64+
},
65+
"tags": []
66+
}
67+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { PluginClient } from '@remixproject/plugin'
2+
import { createClient } from '@remixproject/plugin-webview'
3+
import EventManager from 'events'
4+
5+
export class CircomPluginClient extends PluginClient {
6+
public internalEvents: EventManager
7+
8+
constructor() {
9+
super()
10+
this.methods = ['init', 'parse']
11+
createClient(this)
12+
this.internalEvents = new EventManager()
13+
this.onload()
14+
}
15+
16+
init(): void {
17+
console.log('initializing noir plugin...')
18+
}
19+
20+
onActivation(): void {
21+
this.internalEvents.emit('noir_activated')
22+
}
23+
24+
async parse(path: string, fileContent?: string) {
25+
26+
}
27+
}

apps/noir-compiler/src/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Noir - Compiler</title>
6+
<base href="./" />
7+
8+
<meta name="viewport" content="width=device-width, initial-scale=1" />
9+
<!-- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous"/> -->
10+
<!-- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> -->
11+
<link rel="stylesheet" integrity="ha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf"
12+
crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
13+
</head>
14+
<body>
15+
<script>
16+
var global = window
17+
</script>
18+
<div id="root"></div>
19+
<script src="snarkjs.min.js"> </script>
20+
<script src="https://kit.fontawesome.com/41dd021e94.js" crossorigin="anonymous"></script>
21+
</body>
22+
</html>

apps/noir-compiler/src/main.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import React from 'react'
2+
import { createRoot } from 'react-dom/client'
3+
4+
const container = document.getElementById('root')
5+
6+
if (container) {
7+
createRoot(container).render(<></>)
8+
}

apps/noir-compiler/src/polyfills.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Polyfill stable language features. These imports will be optimized by `@babel/preset-env`.
3+
*
4+
* See: https://github.com/zloirock/core-js#babel
5+
*/
6+
import 'core-js/stable';
7+
import 'regenerator-runtime/runtime';

apps/noir-compiler/src/profile.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "noir-compiler",
3+
"kind": "provider",
4+
"displayName": "Noir Compiler",
5+
"events": [],
6+
"version": "2.0.0",
7+
"methods": ["init", "parse"],
8+
"canActivate": [],
9+
"url": "",
10+
"description": "Enables support for noir circuit compilation",
11+
"icon": "assets/img/circom-icon-bw-800b.webp",
12+
"location": "sidePanel",
13+
"documentation": "",
14+
"repo": "https://github.com/ethereum/remix-project/tree/master/apps/noir-compiler",
15+
"maintainedBy": "Remix",
16+
"authorContact": ""
17+
}

apps/noir-compiler/src/snarkjs.min.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/noir-compiler/tsconfig.app.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../dist/out-tsc",
5+
"types": ["node"]
6+
},
7+
"files": [
8+
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
9+
"../../node_modules/@nrwl/react/typings/image.d.ts"
10+
],
11+
"exclude": [
12+
"jest.config.ts",
13+
"**/*.spec.ts",
14+
"**/*.test.ts",
15+
"**/*.spec.tsx",
16+
"**/*.test.tsx",
17+
"**/*.spec.js",
18+
"**/*.test.js",
19+
"**/*.spec.jsx",
20+
"**/*.test.jsx"
21+
],
22+
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
23+
}
24+

apps/noir-compiler/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"jsx": "react-jsx",
5+
"allowJs": true,
6+
"esModuleInterop": true,
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"files": [],
10+
"include": [],
11+
"references": [
12+
{
13+
"path": "./tsconfig.app.json"
14+
}
15+
]
16+
}
17+

0 commit comments

Comments
 (0)