-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to execute scribble programmatically #22
Comments
Hi! This is a great idea. We currently don't have the bandwith to build a proper library interface for scribble, but will keep the issue around to track this. Just to understand, what would you like to build on top of it? Perhaps this is something that can be solved with the capabilities of the underlying parsing/AST modification library - https://github.com/consensys/solc-typed-ast |
Can you describe what you want the API would expose? Especially if you can highlight functionality that you want in the API, that the CLI doesn't expose. If we can define a small API, maybe we can do this quicker |
I need to look into it again but from memory, what I would like is
The latter would work very well with hardhat as it has the ability to request source to be transformed before being tested |
@wighawag is what you would like to do something like:
Which would run the tests with scribble instrumentation? |
@JoranHonig |
Actually probably more like |
When passing in a whole directory worth of files in-memory, what is the data structure that Hardhat uses? Can you point me at an example in the code of a bunch of files or compilation artifacts being passed in to another plugin in-memory? |
@cd1m0 the plugin mentioned above does it on a file per file basis : https://github.com/wighawag/hardhat-preprocessor/blob/8716fc7d330a31cf5bc9e3c5b8ed5937fe450871/src/index.ts#L121 If this is not enough, a change in hardhat should not be too hard so you can process the whole source globally, but I don't think this is required for scribble ? |
There are 2 possible input modes for Scribble:
In the second mode, note that even if you only have annotations in So if you are passing files in-memory, you need to specify all files needed to compile a contract, and also probably let Scribble know whats the original path for each one, so that we can resolve imports. |
@cd1m0 thanks for the info. this might indeed require some changes to hardhat, but should not be to hard to add . So if scribble offered an api to pass the data as argument and get the result as output, then all can be done in memory |
Currently scribble is designed to be used from cli
to make it easier to write tool around scribble, it would be great if we could execute it programmatically from js.
Maybe it is just a matter of documentation ?
The text was updated successfully, but these errors were encountered: