Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

refactory solcjs module #77

Closed
2 of 3 tasks
alincode opened this issue Dec 7, 2018 · 3 comments
Closed
2 of 3 tasks

refactory solcjs module #77

alincode opened this issue Dec 7, 2018 · 3 comments
Assignees
Labels
#compiler specification category
Milestone

Comments

@alincode
Copy link

alincode commented Dec 7, 2018

@todo

  • modularize compiler code
  • minimize code
  • implement module API as specified below

Is your feature request related to a problem? Please describe.

  • it should be able support all version, and easy to expand.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@serapath advice todo

1. solcjs.version2url --->  await solcjs.versions
2. solcjs ---> await solcjs
3. compiler ---> await compiler
4. add compiler.version function return { name: '', url: ''}
@alincode alincode self-assigned this Dec 7, 2018
@serapath
Copy link
Contributor

serapath commented Dec 7, 2018

haha :-) when you click new issue there is a small link below Don’t see your issue here? Open a regular issue. which allows you to open an issue without a template.

@serapath
Copy link
Contributor

serapath commented Jan 23, 2019

I checked your modules:

  1. i like those:
    https://www.npmjs.com/package/ajax-caching
    https://www.npmjs.com/package/solc-version

  2. not yet sure - need to see an example how they work with the compiler import callback
    https://www.npmjs.com/package/solc-import
    https://www.npmjs.com/package/solc-resolver
    (also how they would look like if they would use many small resolver modules for each backend (e.g. swarm, github, ipfs, etc...)

  3. i wish this one would be much more raw and minimal:
    https://www.npmjs.com/package/solcjs-core

  4. I am not yet sure about this one - depends on solcjs-core which would be cool if it was more minimal
    https://www.npmjs.com/package/solcjs-lightweight

@alincode
Copy link
Author

alincode commented Feb 1, 2019

@serapath

implement a small resolver module

const ResolverEngine = require('solc-resolver').ResolverEngine;
let resolverEngine = new ResolverEngine();
let resolveGithub = require('resolve-github');
resolverEngine.addResolver(resolveGithub);
let resolveIpfs = require('resolve-ipfs');
resolverEngine.addResolver(resolveIpfs);

const getImportContent = async function (path) {
  return myDB.has(path) ? myDB.get(path) : await resolverEngine.require(path);
};

let output = await compiler(sourceCode, getImportContent);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
#compiler specification category
Projects
None yet
Development

No branches or pull requests

2 participants