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

@wasm-idle/core

v1.4.0

Published

Framework-neutral contracts and helpers for wasm-idle hosts

Readme

@wasm-idle/core

Framework-neutral contracts and helpers for wasm-idle hosts: the Sandbox / SandboxLoader adapter contract, createPlaygroundBinding(), canonical language IDs, typed runtime errors, the structured execution request/result types and limits, and the persistent runtime asset cache. The React, Vue, Svelte, Node, terminal, and debug packages are built on these contracts.

This package contains code only. It does not include or select language runtimes: hosts pass a SandboxLoader that returns a Sandbox for a language, plus the runtime asset URLs those sandboxes load from.

pnpm add @wasm-idle/core

Usage

import { createPlaygroundBinding, isWasmIdleError } from '@wasm-idle/core';
import { loadSandbox } from './sandboxes'; // your SandboxLoader

const binding = createPlaygroundBinding('https://cdn.example.com/wasm-idle', loadSandbox);
const code = 'int main(void) { return 0; }';
const options = { limits: { runTimeoutMs: 10_000 } };

try {
	const sandbox = await binding.load('c'); // normalized to the canonical ID 'C'
	sandbox.output = (chunk) => console.log(chunk);
	await sandbox.load(code, false, [], options);
	const result = await sandbox.run(code, false, false, undefined, [], options);
	console.log(result === false ? 'failed' : 'ok');
} catch (error) {
	if (!isWasmIdleError(error)) throw error;
	console.error(error.code, error.phase, error.message);
} finally {
	await binding.dispose();
}

binding.load(language) normalizes the language ID, calls the loader, and returns a BoundSandbox with the binding's runtime assets applied. Every sandbox call goes through one admission boundary: execution limits, AbortSignal cancellation, output and diagnostic caps, and exclusive ownership are enforced there. Sandboxes that implement execute(request) also accept a structured ExecutionRequest and return a validated ExecutionResult with stdout, stderr, exitCode, diagnostics, and timings. binding.dispose() disposes every sandbox the binding created.

Options worth knowing

  • createPlaygroundBinding(runtimeAssets, loadSandbox, options): runtimeAssets is a root URL string or a per-runtime configuration object. options.persistentCache overrides the runtime asset cache policy for this binding, options.prewarm: true allows explicit binding.prewarm(language) calls (nothing is warmed automatically), and options.trustProfile applies a defineRuntimeTrustProfile() policy.
  • SandboxExecutionOptions (the options argument of load and run): limits, signal, stdin, workspaceFiles / activePath, env, and interactive. Unspecified limits fall back to the sandbox's own defaults and then DEFAULT_EXECUTION_LIMITS (for example a 30-second run timeout and 1 MiB of output).
  • Languages: supportedLanguageIds, normalizeLanguageId(), isSupportedLanguageId(), and getLanguageAliasInfo() describe canonical IDs such as PYTHON3 and aliases such as PYTHON.
  • Errors: runtime failures are WasmIdleError subclasses (CompileError, TimeoutError, CancelledError, OutputLimitError, AssetIntegrityError, and others) with code, phase, and recoverable fields. Use isWasmIdleError() to narrow them.
  • Asset cache: configureRuntimeAssetCache(), getRuntimeAssetCacheStats(), clearRuntimeAssetCache(), and pruneRuntimeAssetCache() control the browser cache for verified runtime downloads.

The runtime-specific preflight and manifest helpers (preflight*RuntimeAssets, snapshot*Profile, and similar exports) are the verification contracts used by wasm-idle's own runtimes.

Runtime loading helpers

Compiler hosts share bounded HTTP(S) asset loading and decompression through @wasm-idle/core/runtime-asset-loader (readBuffer, fetchRuntimeJson, decompressGzip, and WebAssembly compilation helpers). Cached buffers and modules are scoped to the supplied fetch provider; cancellable loads bypass those shared caches. Hosts still verify manifest and asset hashes before executing downloaded code.

@wasm-idle/core/runtime-tar exports the default untar function and TarFileSystem type for installing regular files and directories into a host filesystem. Encoding helpers are available from @wasm-idle/core/runtime-encode. These modules are shared by the GCC and LLVM packages and contain no compiler binaries or target libraries.

Documentation