Commit 1d3cb366 authored by 0mkar's avatar 0mkar

first implementation of resolve with custom handler

parent 2fd155ed
......@@ -4,5 +4,3 @@ const fileContent = rr.resolve('https://github.com/ethereum/greeter.sol')
const input = rr.combineSource({ 'greeter.sol': content })
*/
export * from './resolve'
export * from './combineSource.js'
export * from './getFile'
......@@ -63,15 +63,10 @@ export class ImportResolver {
type: 'ipfs',
match: (url) => { return /^(ipfs:\/\/?.+)/.exec(url) },
handle: (match) => { this.handleIPFS(match[1]) }
},
{
type: 'local',
match: (url) => { return /(^(?!(?:http:\/\/)|(?:https:\/\/)?(?:www.)?(?:github.com)))(^\/*[\w+-_/]*\/)*?(\w+\.sol)/g.exec(url) },
handle: (match) => { this.handleLocal(match[2], match[3]) }
}
]
}
resolve(filePath: string, customHandlers: Handler[]) {
async resolve(filePath: string, customHandlers: Handler[]) {
var imported: Imported = this.previouslyHandled[filePath]
if(imported) {
return imported
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment