{"id":26416,"library":"solidity-compiler","title":"@0x/sol-compiler","description":"Solidity compiler wrapper and artifactor that provides smart recompilation, project-wide compilation, per-file Solidity version management, and configurable artifact output. Current stable version: 7.0.1. Release cadence: irregular, part of 0x monorepo. Key differentiators: intelligent caching (only recompiles changed contracts), automatic version resolution from pragma statements, and standard input description support for flexible artifacts. Ships TypeScript types. Requires Node >=6.12. Suitable for both CLI and programmatic use.","status":"active","version":"7.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/LogvinovLeon/tools","tags":["javascript","typescript"],"install":[{"cmd":"npm install solidity-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add solidity-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add solidity-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"TypeScript typeRoots needed for type resolution","package":"@0x/typescript-typings","optional":true}],"imports":[{"note":"Named ESM import; default import not supported.","wrong":"const Compiler = require('@0x/sol-compiler')","symbol":"Compiler","correct":"import { Compiler } from '@0x/sol-compiler'"},{"note":"CJS destructured import.","wrong":"const Compiler = require('@0x/sol-compiler').default","symbol":"Compiler","correct":"const { Compiler } = require('@0x/sol-compiler')"},{"note":"TypeScript type import, available in 7.x.","wrong":"","symbol":"CompilerOptions","correct":"import { CompilerOptions } from '@0x/sol-compiler'"}],"quickstart":{"code":"import { Compiler } from '@0x/sol-compiler';\n\nasync function compile(): Promise<void> {\n  const compiler = new Compiler({\n    contractsDir: './contracts',\n    artifactsDir: './artifacts',\n    compilerSettings: {\n      outputSelection: {\n        '*': {\n          '*': ['abi', 'evm.bytecode.object'],\n        },\n      },\n    },\n    solcVersion: '^0.8.0',\n    solcVersions: ['0.8.0', '0.8.1'],\n    useDockerisedSolc: false,\n    isOfflineMode: false,\n    shouldCompileIndividually: true,\n    shouldSaveStandardInput: true,\n    standardInput: { language: 'Solidity', sources: {}, settings: {} },\n  });\n\n  await compiler.compile();\n  console.log('Compilation succeeded');\n}\n\ncompile().catch(console.error);","lang":"typescript","description":"Shows basic programmatic usage: instantiate Compiler with paths and options, then call compile()."},"warnings":[{"fix":"Remove useDockerisedSolc and specify solcVersion/solcVersions.","message":"useDockerisedSolc option is deprecated; use solcVersion and solcVersions instead.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Explicitly provide artifactsDir in options.","message":"CompilerOptions interface changed in v7; artifactsDir no longer defaults to a relative path.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Use exact version or define solcVersions array.","message":"Compiling with solcVersion that contains a caret (^) may fail if the exact version is not installed locally.","severity":"gotcha","affected_versions":"*"},{"fix":"Add \"typeRoots\": [\"node_modules/@0x/typescript-typings/types\", \"node_modules/@types\"] to tsconfig.json.","message":"TypeRoots configuration required for TypeScript projects using tsconfig.json.","severity":"gotcha","affected_versions":"*"},{"fix":"Switch to named import { Compiler } from '@0x/sol-compiler'.","message":"Default export removed in v5; use named import { Compiler }.","severity":"breaking","affected_versions":">=5.0.0 <6.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Add \"typeRoots\": [\"node_modules/@0x/typescript-typings/types\", \"node_modules/@types\"] to tsconfig.json, or install @0x/typescript-typings.","cause":"Missing typeRoots configuration or package not installed.","error":"Cannot find module '@0x/typescript-typings/types'"},{"fix":"Either install the version via npm (npm install solc@0.8.0) or add it to the solcVersions array.","cause":"Specified solcVersion is not locally installed or available.","error":"Error: solc version '0.8.0' not found"},{"fix":"Use import { Compiler } from '@0x/sol-compiler' or const { Compiler } = require('@0x/sol-compiler').","cause":"Importing as default instead of named import.","error":"TypeError: Compiler is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}