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

@cfxdevkit/compiler

v1.0.16

Published

Runtime Solidity compiler and contract templates for Conflux DevKit — compile .sol source on-the-fly using solc-js

Downloads

930

Readme

@cfxdevkit/compiler

Runtime Solidity compiler and pre-built contract templates for Conflux DevKit.

Bundles solc-js to compile .sol source in any Node.js environment — no Hardhat, no external compiler binary required.


Why this package?

The CAS Hardhat project (packages/contracts) handles deployment-time compilation of production contracts. This package handles runtime compilation needed by the devkit-cli (and any future tool) when a user pastes or uploads arbitrary Solidity source at runtime.

It also ships two pre-built templates (SimpleStorage, TestToken) for testing deployment and contract interaction in dev environments.


Conflux Compatibility

All compilation defaults to EVM version paris to avoid the PUSH0 opcode (0x5f) introduced in Shanghai. Conflux eSpace does not support PUSH0. Do not override evmVersion to 'shanghai' or later unless your target chain explicitly supports it.


Installation

pnpm add @cfxdevkit/compiler

solc (the Solidity compiler WASM binary) is a direct dependency and is downloaded automatically.


Usage

Compile arbitrary Solidity

import { compileSolidity } from '@cfxdevkit/compiler';

const result = compileSolidity({
  contractName: 'Counter',
  source: `
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.20;
    contract Counter {
      uint256 public count;
      function inc() public { count++; }
    }
  `,
});

if (!result.success) {
  console.error(result.errors);
} else {
  const { bytecode, abi, compilerVersion } = result.contracts[0];
}

Compile multiple files (with imports)

import { compileMultipleSources } from '@cfxdevkit/compiler';

const result = compileMultipleSources({
  'IERC20.sol': interfaceSource,
  'MyToken.sol': tokenSource,   // contains `import "./IERC20.sol";`
});

Use a pre-built template

import { getSimpleStorageContract, getTestTokenContract } from '@cfxdevkit/compiler';

// The result is memoised — compiles only once per process
const { bytecode, abi } = getSimpleStorageContract();

// Deploy with (name, symbol, initialSupply) constructor args
const { bytecode: tokenBytecode, abi: tokenAbi } = getTestTokenContract();

Enumerate all templates

import { TEST_CONTRACTS } from '@cfxdevkit/compiler/templates';

for (const [name, template] of Object.entries(TEST_CONTRACTS)) {
  console.log(name, template.description);
  const artifact = template.getCompiled();
}

Sub-path exports

| Import | Contents | |--------|----------| | @cfxdevkit/compiler | Everything (compiler + templates) | | @cfxdevkit/compiler/compiler | compileSolidity, compileMultipleSources, getSolcVersion, types | | @cfxdevkit/compiler/templates | getSimpleStorageContract, getTestTokenContract, TEST_CONTRACTS |


API

compileSolidity(input: CompilationInput): CompilationResult

Compile a single Solidity source file.

compileMultipleSources(sources, optimizer?, evmVersion?): CompilationResult

Compile multiple source files that may import each other.

getSolcVersion(): string

Return the bundled solc version string, e.g. "0.8.28+commit.7893614a...".

CompilationResult

interface CompilationResult {
  success: boolean;
  contracts: CompilationOutput[];   // bytecode, deployedBytecode, abi, …
  errors:   CompilationError[];
  warnings: CompilationError[];
}

License

Apache-2.0 — see LICENSE.