Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Lock files
package-lock.json
yarn.lock
pnpm-lock.yaml
4 changes: 4 additions & 0 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@aztec/bb.js": "^0.87.9",
"@noir-lang/acvm_js": "^1.0.0-beta.8",
"@noir-lang/noirc_abi": "^1.0.0-beta.8",
"@rollup/plugin-inject": "^5.0.5",
"@types/crypto-js": "^4.2.2",
"@types/elliptic": "^6.4.18",
"@types/react-router-dom": "^5.3.3",
Expand Down
3 changes: 1 addition & 2 deletions front/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Buffer } from 'buffer'
(window as any).Buffer = Buffer
import './shims/buffer.ts';

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
Expand Down
24 changes: 24 additions & 0 deletions front/src/shims/buffer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// src/shims/buffer.ts

// buffer/index.js doğrudan gerçek paketten çekilir, alias’a takılmaz
import { Buffer as NodeBuffer } from 'buffer/index.js';

// Eğer writeBigUInt64BE yoksa ekleyelim
if (!(NodeBuffer.prototype as any).writeBigUInt64BE) {
Object.defineProperty(NodeBuffer.prototype, 'writeBigUInt64BE', {
value(this: Buffer, value: bigint, offset = 0) {
for (let i = 7; i >= 0; --i) {
const byte = Number((value >> BigInt(i * 8)) & 0xffn);
(this as any)[offset + (7 - i)] = byte;
}
return offset + 8;
},
writable: true,
});
}

// Global Buffer’ı da atayalım (bazı kütüphaneler window.Buffer bekleyebilir)
;(window as any).Buffer = NodeBuffer;

// Adından export edelim
export const Buffer = NodeBuffer;
23 changes: 14 additions & 9 deletions front/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
optimizeDeps: {
esbuildOptions: { target: "esnext" },
exclude: ["@noir-lang/noirc_abi", "@noir-lang/acvm_js"],
},
resolve: {
alias: {
buffer: 'buffer',
alias: [
{
find: /^buffer$/,
replacement: path.resolve(__dirname, 'src/shims/buffer.ts'),
},
],
},
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
},
exclude: ['@noir-lang/noirc_abi', '@noir-lang/acvm_js'],
},
define: {
global: 'globalThis',
global: 'window',
},
server: {
fs: {
allow: ['../..'],
},
},
});
})