removed NodeJS dependency from common.js
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
import * as fs from "node:fs";
|
|
||||||
|
|
||||||
export function mixin(child, ...parents) {
|
export function mixin(child, ...parents) {
|
||||||
// child is modified directly, assigning fields from parents that are missing in child. parents fields are
|
// child is modified directly, assigning fields from parents that are missing in child. parents fields are
|
||||||
// assigned by parents order, highest priority first
|
// assigned by parents order, highest priority first
|
||||||
@@ -98,18 +96,6 @@ export class AsyncURLCache extends AsyncAbiCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class AsyncFileCache extends AsyncAbiCache {
|
|
||||||
constructor(pathForKey) {
|
|
||||||
super(async (key) => {
|
|
||||||
const path = this.pathForKey(key)
|
|
||||||
const data = fs.readFileSync(path, 'utf8');
|
|
||||||
return JSON.parse(data);
|
|
||||||
})
|
|
||||||
this.pathForKey = pathForKey
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export class AbiURLCache extends AsyncURLCache {
|
export class AbiURLCache extends AsyncURLCache {
|
||||||
constructor(baseUrl) {
|
constructor(baseUrl) {
|
||||||
super((name)=>{
|
super((name)=>{
|
||||||
@@ -120,16 +106,6 @@ export class AbiURLCache extends AsyncURLCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class AbiFileCache extends AsyncFileCache {
|
|
||||||
constructor(basePath) {
|
|
||||||
super((name)=>{
|
|
||||||
return this.basePath+abiPath(name)
|
|
||||||
})
|
|
||||||
this.basePath = basePath.endsWith('/') ? basePath : basePath + '/'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const files = {
|
const files = {
|
||||||
// If a contract is in a file different than its name, put the exception here
|
// If a contract is in a file different than its name, put the exception here
|
||||||
// 'IVaultLogic' : 'IVault', // for example
|
// 'IVaultLogic' : 'IVault', // for example
|
||||||
|
|||||||
Reference in New Issue
Block a user