# @0x/sol-compiler

> Solidity compiler wrapper and artifactor

Latest version **4.8.5** (published 2023-04-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @0x/sol-compiler
pnpm add @0x/sol-compiler
yarn add @0x/sol-compiler
bun add @0x/sol-compiler
```

Provides the command `sol-compiler`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.8.5 |
| Published | 2023-04-07 |
| First published | 2018-10-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=6.12 |
| Dependencies | 23 |
| Unpacked size | 168.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 98 |
| Author | Amir Bandeali |
| Maintainers | rhinodavid, mwelche, savdont, eobbad, aeph4muh, idokleinman, jadetran, kyuc, henryzhu, tobernguyen, dex_tracker, dekz, amirbandeali, phil-ociraptor |

## Links

- npm: https://www.npmjs.com/package/@0x/sol-compiler
- Repository: https://github.com/0xProject/tools
- Homepage: https://github.com/0xProject/tools/tree/main/sol-compiler
- Issues: https://github.com/0xProject/tools/issues
- npm.io page: https://npm.io/package/@0x/sol-compiler

## Dependencies (23)

- [solc](https://npm.io/package/solc.md) ^0.8
- [chalk](https://npm.io/package/chalk.md) ^2.3.0
- [yargs](https://npm.io/package/yargs.md) ^17.5.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [semver](https://npm.io/package/semver.md) 5.5.0
- [chokidar](https://npm.io/package/chokidar.md) ^3.0.2
- [@0x/types](https://npm.io/package/@0x/types.md) ^3.3.7
- [@0x/utils](https://npm.io/package/@0x/utils.md) ^7.0.0
- [pluralize](https://npm.io/package/pluralize.md) ^7.0.0
- [@0x/assert](https://npm.io/package/@0x/assert.md) ^3.0.36
- [@types/node](https://npm.io/package/@types/node.md) 12.12.54
- [@types/yargs](https://npm.io/package/@types/yargs.md) ^11.0.0
- [web3-eth-abi](https://npm.io/package/web3-eth-abi.md) ^1.0.0-beta.24
- [ethereum-types](https://npm.io/package/ethereum-types.md) ^3.7.1
- [strip-comments](https://npm.io/package/strip-comments.md) ^2.0.1
- [ethereumjs-util](https://npm.io/package/ethereumjs-util.md) ^7.1.5
- [@0x/json-schemas](https://npm.io/package/@0x/json-schemas.md) ^6.4.6
- [@0x/sol-resolver](https://npm.io/package/@0x/sol-resolver.md) ^3.1.13
- [@0x/web3-wrapper](https://npm.io/package/@0x/web3-wrapper.md) ^8.0.1
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.5.0
- [require-from-string](https://npm.io/package/require-from-string.md) ^2.0.1
- [@0x/typescript-typings](https://npm.io/package/@0x/typescript-typings.md) ^5.3.2

## Recent versions

- 4.8.5 (latest) — 2023-04-07
- 3.2.0-beta.4 (protocolV3) — 2019-12-02
- 4.8.4 — 2023-04-07
- 4.8.3 — 2023-01-26
- 4.8.2 — 2022-08-18
- 4.8.1 — 2022-03-16
- 4.8.0 — 2022-03-16
- 4.7.9 — 2022-02-26
- 4.7.8 — 2022-01-19
- 4.7.7 — 2021-10-27
- 4.7.6 — 2021-09-23
- 4.7.5 — 2021-08-25
- 4.7.4 — 2021-06-28
- 4.7.3 — 2021-04-28
- 4.7.2 — 2021-04-26
- … 72 more at https://npm.io/package/@0x/sol-compiler/versions

## README

## @0x/sol-compiler

Sol-compiler is a wrapper around [solc-js](https://www.npmjs.com/package/solc) that adds:

-   Smart re-compilation: Only recompiles when smart contracts have changed
-   Ability to compile an entire project instead of only individual `.sol` files
-   Compilation using the Solidity version specified at the top of each individual `.sol` file
-   Proper parsing of Solidity version ranges
-   Support for the standard [input description](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description) for what information you'd like added to the resulting `artifacts` file (i.e 100% configurable artifacts content).

### Read the [Documentation](https://0x.org/docs/tools/sol-compiler).

## Installation

#### CLI Installation

```bash
yarn global add @0x/sol-compiler
```

#### API Installation

```bash
yarn add @0x/sol-compiler
```

If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:

```json
"compilerOptions": {
    "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
}
```

**Import**

```typescript
import { Compiler } from '@0x/sol-compiler';
```

or

```javascript
var Compiler = require('@0x/sol-compiler').Compiler;
```

## Contributing

We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.

Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.

### Install dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

```bash
yarn config set workspaces-experimental true
```

Then install dependencies

```bash
yarn install
```

### Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

```bash
PKG=@0x/sol-compiler yarn build
```

Or continuously rebuild on change:

```bash
PKG=@0x/sol-compiler yarn watch
```

### Clean

```bash
yarn clean
```

### Lint

```bash
yarn lint
```

### Run Tests

```bash
yarn test
```

---
_Source: https://npm.io/package/@0x/sol-compiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
