Registry / devops / embark-compiler

embark-compiler

JSON →
library6.0.0jsnpmunverified

Embark compiler module that abstracts the compiler interface and exposes a plugin API for contract extensions. Current stable version is 6.0.0, part of the Embark framework (release cadence: major versions every 6-12 months, nightly releases). Key differentiators: integrates with Solidity (solc), supports plugin-based compiler registration, and provides a command-driven compilation flow. Compared to alternatives like Truffle Compile, it is tightly coupled with the Embark ecosystem and uses a unique event-based request pattern.

npm install embark-compiler
INSTALL
IMPORT
SIG · EMBARK-COMPILER
E
embark-compiler
devopsjavascriptv6.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

File
import { File } from 'embark-core'
const { File } = require('embark-compiler')
File class is part of embark-core, not embark-compiler. ESM import required.
compiler:contracts:compile
embark.events.request('compiler:contracts:compile', contractFiles, options, callback)
This is an event request, not a direct import. Used via the Embark events system.
registerCompiler
plugins.registerCompiler('extension', callback)
require('embark-compiler').registerCompiler(...)
registerCompiler is a plugin API method on the plugins object, not a named export.

Compiles a Solidity contract using Embark's event-based request system, showing the minimal setup with a File object.

import { File } from 'embark-core'; const contractFiles = [new File({ path: 'SimpleStorage.sol', type: 'custom', resolver: (cb) => cb('pragma solidity ^0.5.0; contract SimpleStorage { uint storedData; }') })]; embark.events.request('compiler:contracts:compile', contractFiles, { isCoverage: false }, (err, compiledObject) => { if (err) { console.error(err); return; } console.log('Bytecode:', compiledObject.runtimeBytecode); });
Debug
Known issues
breakingembark-compiler v6.0.0 drops support for Node <10.17.0 and npm <6.11.3.
fix
Upgrade Node to >=10.17.0 and npm to >=6.11.3 or yarn >=1.19.1.
affects: >=6.0.0
deprecatedThe old callback-based plugin API (registerCompiler) may be removed in future versions.
fix
Use the event-based request pattern instead (compiler:contracts:compile).
affects: >=6.0.0
gotchaFile objects must include a 'type' property; omitting it may cause errors.
fix
Always set type: 'custom' or appropriate value when creating File instances.
affects: >=5.0.0
gotchaCompilation options parameter is required and must include isCoverage (boolean).
fix
Pass { isCoverage: false } if not using coverage.
affects: >=6.0.0
Errors
Common errors & fixes
Cannot find module 'embark-core'
embark-core is a peer dependency not automatically installed.
fix
Run 'npm install @embark/core' or ensure Embark framework is properly installed.
Error: ContractSimpleStorage.sol not found
File path does not match the contract's actual file path in the resolver.
fix
Set path to the contract's original filename, e.g., 'SimpleStorage.sol'.
TypeError: contractFiles is not iterable
File objects passed in an incorrect format or not an array.
fix
Wrap File in an array: [new File({...})].
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
@embark/corerequiredProvides the Embark runtime, events, and plugin system
Agent activity
2 hits · last 30 days
node
2
Resources
embark-compiler — npm install embark-compiler · libregistry