npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

solidity-workspace

v0.3.1

Published

Turn solidity source code into AST objects with easy access to contracts, functions, ...

Readme

solidity-workspace

A simple workspace based interface to the solidity-parser and objectified Abstract Syntax Tree

Workspace Mode

const ws = new Workspace();
ws.add('/path/to/solidity.sol');
ws.withParserReady().then(() => { 
  /* do things */
  console.log(ws.sourceUnits);
});

Single Source Unit Mode

const su = new SourceUnit().fromSource(sourceCode);
console.log(su.imports);

TLDR;

This library works like a headless IDE for solidity projects. Instead of manually parsing file-by-file you get meaningful objects you can work with.

  1. create a ws = new Workspace()
  2. asynchronously add solidity source code files to the workspace ws.add('/path/to/solidity.sol', {content: optionalFileContent})
  3. in the meantime, the added source units and their dependencies get parsed into. new SourceUnit() objects that provide easy access to solidity source unit properties
  4. add as many files as you want
  5. finally wait for all the tasks to finish ws.withParserReady().then(() => { /* do things */}) (note: some internal magic requires 2 passes)
  6. search for contracts, source units, ....
  7. access source-unit, contract, function properties in an object oriented fashion

Check out the cli.js for an example on how to use this.

⇒  solidity-workspace help
solidity-workspace <cmd> [args]

Commands:
  solidity-workspace flatten <files..>      show file contracts structure.
  solidity-workspace dependencies           output a linearized list of smart
  <files..>                                 contract dependencies (linerized
                                            inherited parents)
  solidity-workspace stats <files..>        random parser stats
  solidity-workspace parse <files..>        print parsed objects
  solidity-workspace funcsigs <files..>     print function signatures

Options:
  -h, --help     Show help                                             [boolean]
  -v, --version  Show version number                                   [boolean]
flatten (lexical)

#> solidity-workspace flatten code/contracts/core/Core.sol --output flat.sol

stats
#>  solidity-workspace stats contracts/core/Core.sol                       
→ fromFile(): contracts/core/Core.sol
→ fromSource(): hash=daf3a03e589430ff94e3304fbbfcc1e7ed0134fb
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/proxy/Initializable.sol
→ fromSource(): hash=f1177d352b287ab27db3368a956064663fb11fe5
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/utils/Address.sol
→ fromSource(): hash=66db1de364ee244b292cf4cc5e63385e8f6b9420
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/core/Permissions.sol
→ fromSource(): hash=6312be1e663c80ee4ee027b6a30a5bad7d950cb4
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/access/AccessControl.sol
→ fromSource(): hash=e19379096fa4c8eaa567842d9c3f62f056fe17e6
 * parseAst()
Struct member external call detection not yet implemented
Struct member external call detection not yet implemented
Struct member external call detection not yet implemented
Struct member external call detection not yet implemented
Struct member external call detection not yet implemented
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/utils/EnumerableSet.sol
→ fromSource(): hash=899a51116900e639e216d778a3fb01d3f3b94b23
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/utils/Context.sol
→ fromSource(): hash=02ebe0e93c5d1da25b91ba7f4cfb990a949263f8
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/core/IPermissions.sol
→ fromSource(): hash=7ddf1c7a5b05af5b19a9b47530c8f5f0138aeba7
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/core/ICore.sol
→ fromSource(): hash=1bae17efde3a1064ec30a279c6dde3d2cb622de7
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/token/IFei.sol
→ fromSource(): hash=5cb090b66a4a2cb7cf298d38ff34bd2649a3d6fd
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol
→ fromSource(): hash=198932076d74067dee7acdde834235339aa9d909
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/token/Fei.sol
→ fromSource(): hash=a20178cdbec81f2383d13c5df8bf02f9418691d0
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/ERC20Burnable.sol
→ fromSource(): hash=856518dc7da0422e563ea7dc8fae4704c95b2388
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol
→ fromSource(): hash=afd4175923b146603ba609a9e9e7f0b678aa1853
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/math/SafeMath.sol
→ fromSource(): hash=3906485abfad296a4f57098778ae0b75fec61892
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/token/IIncentive.sol
→ fromSource(): hash=5715475e1610cee51aa86360a8cf38c61abb34c9
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/refs/CoreRef.sol
→ fromSource(): hash=e38ef7a3f55c505efc34483adf8de4d73278b0ee
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/refs/ICoreRef.sol
→ fromSource(): hash=903484983c7c9e64a7896d11292c0dcaa14940a8
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): node_modules/@openzeppelin/contracts/utils/Pausable.sol
→ fromSource(): hash=6c67f31034125f74c134dc0903c0f176cecccbd6
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
→ fromFile(): contracts/dao/Tribe.sol
→ fromSource(): hash=ba037beab397be55e837b36010e6b2cdeefcb732
 * parseAst()
  * _resolveIdentifiers()
  * parseImports()
SourceUnits: 20
Contracts: 20
Unique Contract Names (excluding duplicate contract names): 20

🙏 Contributors

🏆 References

  • https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor&ssr=false#overview