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

vimble

v0.0.1

Published

Vimble allows you to execute code in an isolated context.

Readme

Vimble

Vimble allows you to execute code in an isolated context.

import * as vimble from 'https://cdn.jsdelivr.net/npm/[email protected]/src/index.mjs';
// OR "https://ga.jspm.io/npm:[email protected]/src/index.mjs";

Or install via npm

npm install vimble

Quick Start

Using run and InjectedConsole

import run,  { InjectedConsole } from 'vimble';
const localConsole = new InjectedConsole();
await run('console.log(1 + 2);', { console: localConsole });
console.log(localConsole.result); // logs "3"

Uing runWithInjectedConsole

import { runWithInjectedConsole as run } from 'vimble';
console.log(await run('console.log(1 + 2);')); // logs "3"

API

run(code, context)

Executes JavaScript code in an isolated context with specified global variables.

Parameters:

  • code (string): The JavaScript code to execute
  • context (Object): Object containing global variables to inject into the execution context

Returns: Promise - Result of the executed code

Example:

import { run } from 'vimble';
// Access modified global variables
const obj = { count: 0 };
await run('obj.count += 1;', { obj });
console.log(obj.count); // outputs: 1

Global objects must be specified in the context object

import { run } from 'vimble';
// Access modified global variables
const obj = { text: "" };
await run('await fetch("https://example.com").then((response) => response.text()).then((text) => obj.text = text);', { obj, fetch});
console.log(obj.text); // outputs: 1

InjectedConsole

A custom console implementation that captures output and errors in isolated contexts.

Methods:

  • log(...args): Logs messages to the output buffer
  • info(...args): Alias for log
  • warn(...args): Alias for log
  • error(...args): Logs messages to the error buffer
  • reset(): Resets output and error buffers

Properties:

  • result: Gets the combined output, prioritizing errors if present
  • info: Gets information about console including error and output counts

Example:

import { InjectedConsole } from 'vimble';

const console = new InjectedConsole();
console.log('Hello');
console.log('World');

// Error messages take priority
console.result; // outputs: "Hello World"
console.error('Error occurred');
console.result; // outputs: "Error occurred"

runWithInjectedConsole(code, [context])

Executes JavaScript code with a custom console implementation and returns the console output.

Parameters:

  • code (string): The JavaScript code to execute
  • context (Object, optional): Additional context variables to inject into the execution environment

Returns: Promise - Console output from the code execution

Example:

import { runWithInjectedConsole as run } from 'vimble';

// Capture console output
const output = await run(`
  console.log('Hello');
  console.log('World');
`);
console.log(output); // outputs: "Hello\nWorld"