{"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,"search_vec":"'0x':34 '0x/sol-compiler':1 '6.12':63 '7.0.1':28 'artifact':23,57 'artifactor':6 'automat':44 'cach':39 'cadenc':30 'chang':42 'cli':67 'compil':3,14 'configur':22 'contract':43 'current':25 'descript':53 'differenti':37 'file':17 'flexibl':56 'input':52 'intellig':38 'irregular':31 'javascript':71 'key':36 'manag':20 'monorepo':35 'node':62 'output':24 'part':32 'per':16 'per-fil':15 'pragma':48 'programmat':69 'project':12 'project-wid':11 'provid':8 'recompil':10,41 'releas':29 'requir':61 'resolut':46 'ship':58 'smart':9 'solid':2,18 'stabl':26 'standard':51 'statement':49 'suitabl':64 'support':54 'type':60 'typescript':59,72 'use':70 'version':19,27,45 'wide':13 'wrapper':4","created_at":"2026-05-01T13:49:52.039746+00:00","updated_at":"2026-05-01T13:49:52.039746+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"solidity-compiler","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/LogvinovLeon/tools","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/solidity-compiler","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}