7 changed files with 1035 additions and 206 deletions
File diff suppressed because it is too large
@ -0,0 +1,2 @@ |
|||
// Empty module to satisfy Node.js built-in module imports
|
|||
export default {}; |
@ -0,0 +1,17 @@ |
|||
// Minimal crypto module implementation for browser using Web Crypto API
|
|||
const crypto = { |
|||
...window.crypto, |
|||
// Add any Node.js crypto methods that might be needed
|
|||
randomBytes: (size) => { |
|||
const buffer = new Uint8Array(size); |
|||
window.crypto.getRandomValues(buffer); |
|||
return buffer; |
|||
}, |
|||
createHash: () => ({ |
|||
update: () => ({ |
|||
digest: () => new Uint8Array(32) // Return empty hash
|
|||
}) |
|||
}) |
|||
}; |
|||
|
|||
export default crypto; |
@ -0,0 +1,18 @@ |
|||
// Minimal fs module implementation for browser
|
|||
const fs = { |
|||
readFileSync: () => { |
|||
throw new Error('fs.readFileSync is not supported in browser'); |
|||
}, |
|||
writeFileSync: () => { |
|||
throw new Error('fs.writeFileSync is not supported in browser'); |
|||
}, |
|||
existsSync: () => false, |
|||
mkdirSync: () => {}, |
|||
readdirSync: () => [], |
|||
statSync: () => ({ |
|||
isDirectory: () => false, |
|||
isFile: () => false |
|||
}) |
|||
}; |
|||
|
|||
export default fs; |
@ -0,0 +1,13 @@ |
|||
// Minimal path module implementation for browser
|
|||
const path = { |
|||
resolve: (...parts) => parts.join('/'), |
|||
join: (...parts) => parts.join('/'), |
|||
dirname: (p) => p.split('/').slice(0, -1).join('/'), |
|||
basename: (p) => p.split('/').pop(), |
|||
extname: (p) => { |
|||
const parts = p.split('.'); |
|||
return parts.length > 1 ? '.' + parts.pop() : ''; |
|||
} |
|||
}; |
|||
|
|||
export default path; |
Loading…
Reference in new issue