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

@suntime-js/core

v0.7.0

Published

Evaluate javascript in a sandboxed environment.

Readme

@suntime-js/core

(static-js was taken (So was js-engine))

A (work in progress) JavaScript interpreter built on the TC39 ECMAScript standard, implementing asyncronous / non-blocking execution, sandboxing, modern language features, and full debugging support.

A spiritual successor to static-eval.

Try it out in the sandbox!

Spec Compliance

This project is being ran against the Test262 test suite to ensure spec compliance. This is a work-in-progress, and full coverage has not yet been obtained.

Test262 Language Suite

Test262 Builtins Suite

Sandboxing and Security

Unlike static-eval, this project has ambitions of providing a secure sandbox from which untrusted code can be safely ran.

The fundimental difference with static-eval is that static-js operates entirely against its own implementation of the intrinsic javascript types, complete with its own prototype chain. This seeks to ensure that the code being ran is never able to manipulate the system into accessing the native properties of the underlying native objects, which would allow it to eventually reach a function constructor and therefor gain arbitrary code execution.

Instead, while the code in the sandbox will have access to eval() and the function constructor, those functions will instead run their code inside the sandbox, preserving the integrity of the host system.

More information on StaticJs security

Quick Usage (native JS interop)

StaticJs provides quick functions for evaluating simple code: evaluateExpressionSync and evaluateScriptSync. These functions take strings as their first argument, and return a coerced native value.

Note that these functions will drain all microtasks enqueued during their evaluation before returning. This means that any promise resolutions in the scripts will also be ran to completion.

import { evaluateExpressionSync } from "@suntime-js/core";

const result = evaluateExpressionSync("2 + 2");

Warning: Using StaticJs this way is vulnurable to deadlocks with infinite loops, and can introduce security complications where VM code can be unexpectedly invoked through interacting with the resulting values (eg: property getters and setters).

For more information, including solutions for breaking loops, see Quick Start.

Detailed example

import { StaticJsRealm, createTimeSharingTaskRunner } from "@suntime-js/core";

let myModuleResolveAwait;
const realm = StaticJsRealm({
  runTask: createTimeSharingTaskRunner({
    yieldTime: 100,
    operationsPerIteration: 1000,
    maxRunTime: 60 * 1000
  }),
  global: {
    properties: {
      sayHello: {
        value: () => console.log("Hello World");
      },
      registerCallback: {
        value: (cb) => myModuleResolveAwait = cb;
      }
    }
  },
  modules: {
    "my-module": `
      const { promise, resolve } = Promise.withResolvers();
      registerCallback(resolve);
      await promise;
      export const foo = 42;
    `
  }
});

const modulePromise = realm.evaluateModule(`
  import { foo } from "my-module";
  export function addFoo(value) {
    return value + foo;
  }
`);

myModuleResolveAwait();

const module = await modulePromise;

const addFoo = await module.getExportAsync("addFoo");

const result = await addFoo.callAsync(realm.types.undefined, realm.types.number(10));

What is supported

  • Strict directive
  • Primitives
  • Arrays
  • Set, Map
  • Math
  • Error (and variants), try / catch
  • Promises
  • Functions / Arrow functions
  • Async Functions
  • Generator functions
  • Async generator functions
  • Top-level await
  • Symbols (including engine behavior)
    • Symbol.iterator
    • Symbol.hasInstance
    • Symbol.species
    • Symbol.isConcatSpreadable
    • Symbol.toPrimitive
    • Symbol.unscopables
    • Symbol.toStringTag
  • Control flow / loops
  • Unary and binary operators
  • Optional call expressions
  • Destructuring
  • Spread operators (including Symbol.iterator usage)
  • eval / Function constructor.
  • Classes
    • Private names
  • Proxy
  • ECMAScript Modules
    • Async modules
    • Exports
    • Importing from host-defined modules
    • Importing from sandboxed modules

Notable things not (yet) supported

  • All well-known symbols not listed above
  • Optional member expressions
  • Date
  • Temporal
  • Regex
  • JSON
  • WeakMap, WeakRef, FinalizationRegistry
  • 'using' syntax; disposables