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

@xspect-build/cross-build

v1.0.0

Published

Cross-compile Rust projects without Docker.

Readme

@xspect-build/cross-build

Cross-compile Rust projects without Docker.

This package extracts the cross-compilation logic from @napi-rs/cli into a standalone package that can be used by any Rust project, not just those using NAPI-RS.

Features

  • Cross-compile for Linux targets using @napi-rs/cross-toolchain
  • Cross-compile for Windows using cargo-xwin
  • Cross-compile for other platforms using cargo-zigbuild
  • Android NDK support for Android targets
  • WASI support for WebAssembly targets
  • OpenHarmony support for HarmonyOS targets

Installation

npm install @xspect-build/cross-build
# or
yarn add @xspect-build/cross-build
# or
pnpm add @xspect-build/cross-build

Usage

Basic Build

import { build } from '@xspect-build/cross-build'

// Cross-compile for Linux ARM64
const result = await build({
  target: 'aarch64-unknown-linux-gnu',
  release: true,
  useNapiCross: true,
})

console.log('Build succeeded:', result.success)
console.log('Environment variables used:', result.envs)

Get Cross-Compile Environment Variables

If you want to get the environment variables needed for cross-compilation without actually building, you can use getCrossCompileEnv:

import { getCrossCompileEnv } from '@xspect-build/cross-build'

const env = getCrossCompileEnv({
  target: 'aarch64-unknown-linux-gnu',
  useNapiCross: true,
})

console.log(env)
// {
//   CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: '...',
//   TARGET_CC: '...',
//   TARGET_CXX: '...',
//   ...
// }

Parse Target Triple

import { parseTriple } from '@xspect-build/cross-build'

const target = parseTriple('aarch64-unknown-linux-gnu')
console.log(target)
// {
//   triple: 'aarch64-unknown-linux-gnu',
//   platform: 'linux',
//   arch: 'arm64',
//   abi: 'gnu',
//   platformArchABI: 'linux-arm64-gnu'
// }

Options

CrossBuildOptions

| Option | Type | Description | |--------|------|-------------| | target | string | Target triple (e.g., 'aarch64-unknown-linux-gnu') | | cwd | string | Working directory for the build | | manifestPath | string | Path to Cargo.toml manifest file | | targetDir | string | Directory for build artifacts | | release | boolean | Build in release mode | | verbose | boolean | Show verbose output | | profile | string | Build profile (e.g., 'release', 'dev') | | useNapiCross | boolean | Use @napi-rs/cross-toolchain for Linux cross-compilation | | crossCompile | boolean | Use cargo-zigbuild/cargo-xwin for cross-compilation | | useCross | boolean | Use cross-rs instead of cargo | | strip | boolean | Strip debug symbols | | package | string | Package name in workspace | | bin | string | Binary name to build | | features | string[] | Features to enable | | allFeatures | boolean | Enable all features | | noDefaultFeatures | boolean | Disable default features | | cargoArgs | string[] | Additional cargo arguments | | env | Record<string, string> | Additional environment variables |

Supported Targets

Linux Targets (via @napi-rs/cross-toolchain)

  • aarch64-unknown-linux-gnu
  • aarch64-unknown-linux-musl
  • x86_64-unknown-linux-gnu
  • x86_64-unknown-linux-musl
  • armv7-unknown-linux-gnueabihf
  • riscv64gc-unknown-linux-gnu
  • powerpc64le-unknown-linux-gnu
  • s390x-unknown-linux-gnu
  • And more...

Windows Targets (via cargo-xwin)

  • x86_64-pc-windows-msvc
  • i686-pc-windows-msvc
  • aarch64-pc-windows-msvc

Other Platforms (via cargo-zigbuild)

  • macOS (cross-arch)
  • FreeBSD
  • And more...

License

MIT