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

@midnight-ntwrk/midnight-js-compact

v4.0.2

Published

Compact fetcher

Downloads

5,168

Readme

Compact

Compact compiler manager for Midnight smart contracts. Fetches, manages, and runs the compactc compiler.

Installation

yarn add -D @midnight-ntwrk/midnight-js-compact

Quick Start

# Fetch the compiler (version from COMPACTC_VERSION env var)
yarn fetch-compactc

# Compile a contract
yarn run-compactc ./contract.compact ./output

CLI Commands

fetch-compactc

Downloads and manages Compact compiler versions.

| Flag | Description | | --------------------- | ------------------------------------- | | --version=<version> | Specify version to download | | --force | Force re-download existing version | | --list-versions | List all installed versions | | --cleanup=<count> | Keep only the latest N versions | | --help | Show help |

# Download specific version
yarn fetch-compactc --version=1.0.0

# List installed versions
yarn fetch-compactc --list-versions

# Cleanup old versions, keep latest 3
yarn fetch-compactc --cleanup=3

run-compactc

Executes the Compact compiler.

yarn run-compactc <input-file> <output-dir> [options]

Configuration

Environment Variables

| Variable | Description | Default | | --------------------- | ---------------------------------------------------------------- | -------------------------------- | | COMPACTC_VERSION | Version to fetch/run (required if --version not provided) | - | | COMPACT_HOME | Custom Compact installation path (skips managed versions) | - | | COMPACT_REPO | GitHub repository for downloading the compiler | LFDT-Minokawa/compact | | COMPACT_TAG_PREFIX | Release tag prefix prepended to the version | v | | COMPACT_DOCKER_IMAGE| Docker image for unsupported platforms | ghcr.io/midnight-ntwrk/compactc|

Platform Support

| Platform | Architecture | Method | | --------------- | --------------- | -------- | | macOS | arm64, x64 | Binary | | Linux | arm64, x64 | Binary | | Other | - | Docker |

Version Management

The package manages multiple compiler versions in managed/ directory:

managed/
├── 1.0.0/
│   └── compactc
├── 1.1.0/
│   └── compactc
└── 1.2.0/
    └── compactc

When COMPACT_HOME is not set and no specific version is requested, the latest installed version is used.

API

VersionManager

import { VersionManager } from '@midnight-ntwrk/midnight-js-compact';

const manager = new VersionManager(packageDir);

manager.listVersions();                  // Get all installed versions
manager.versionExists('1.0.0');          // Check if version exists
manager.getVersionDir('1.0.0');          // Get version directory path
manager.getCompactcPath('1.0.0');        // Get compactc binary path
manager.removeVersion('1.0.0');          // Remove specific version
manager.cleanupOldVersions(3);           // Keep only latest 3 versions

Utility Functions

import { resolveCompactPath } from '@midnight-ntwrk/midnight-js-compact';

// Resolves path to compactc (respects COMPACT_HOME, falls back to managed versions)
const compactPath = resolveCompactPath(packageDir, optionalVersion);

Resources

Terms & License

By using this package, you agree to Midnight's Terms and Conditions and Privacy Policy.

Licensed under Apache License 2.0.