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

@penumbra-realm/shim

v0.1.2

Published

Research-substrate ShadowRealm shim (TC39 Stage 2.7) backed by iframes — browser/DOM only, not a production polyfill

Readme

@penumbra-realm/shim

A ShadowRealm shim backed by isolated iframes, providing a spec-conformant ShadowRealm on browsers that lack a native implementation (or where native ShadowRealm is not enabled, e.g. Safari TP without JSC_useShadowRealm).

Implements the TC39 ShadowRealm proposal surface (new ShadowRealm(), realm.evaluate(), realm.importValue()) as specified in Stage 2.7 Draft / February 10, 2025.

Browser-only — requires a DOM document; cannot run in Workers or pure-JS contexts.

Design

Each ShadowRealm is backed by a hidden <iframe> whose global is wrapped by a Proxy. The blocking walk replaces non-permitted globals (not in SAFE_ECMA_INTRINSICS + PERMITTED_HOST_GLOBALS in src/constants.js) with getters that log warnings.

Static analysis (src/parser.js) checks for top-level return, new.target, and super using a hand-rolled scanner.

Module loading (src/module-loader.js) uses regex-based ESM transform to CommonJS-style assignments.

Cross-realm interop (src/boundary.js) wraps functions—only functions, primitives, null, undefined cross; non-callable objects are rejected.

Lifecycle: No explicit teardown; cleanup via FinalizationRegistry (degrades on engines without it—there's a leak).

Usage

<script type="module">
  await import('@penumbra-realm/shim');
  const realm = new ShadowRealm();
  realm.evaluate('1 + 2');              // → 3
  realm.importValue('./mod.js', 'default'); // → Promise
</script>

For classic <script>: load dist/shadowrealm.iife.js directly.

import { ShadowRealm, createRealm } from '@penumbra-realm/shim';
const realm = createRealm();
realm.evaluate('Math.max(3, 7)');

Build

npm run build     # produces dist/shadowrealm.esm.js and dist/shadowrealm.iife.js

File map

src/
  bootstrap.js      # entry: installs ShadowRealm, wires debug flag
  shadowrealm.js    # ShadowRealm class + iframe interception
  create-realm.js   # createRealm() factory
  realm-record.js   # iframe + shadow-global proxy
  intrinsics.js     # host intrinsics + cross-frame specialization
  boundary.js       # GetWrappedValue / WrappedFunctionCreate / CreateTypeErrorCopy
  module-loader.js  # ESM loader for importValue
  parser.js         # static restriction scanner
  constants.js      # SAFE_ECMA_INTRINSICS / PERMITTED_HOST_GLOBALS
  lifecycle.js      # FinalizationRegistry cleanup
  debug.js          # shared debug flag

License

MIT — see LICENSE.