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 🙏

© 2024 – Pkg Stats / Ryan Hefner

quarantiner

v0.1.0-alpha.8

Published

A script isolator that runs scripts inside a sandbox iframe

Downloads

113

Readme

Quarantiner

Build Status

[EXPERIMENTAL] Isolates scripts that may modify prototypes by running them inside an <iframe> realm.

What is it?

This is not a security-focused sandbox. It is expected (for now) that a script will be able to escape the sandbox if intentional.

The main purpose of this sandbox is to provide a lightweight isolated script environment (realm) so that incompatible or badly-behaving scripts that modify global objects or global prototypes can be isolated enough from each other to function together.

Recommended usage

It is recommended that you use this alongside a bundler, e.g. via the Rollup plugin rollup-plugin-sandbox.

Alternative usage (if requiring directly)

$ npm i quarantiner

Global API

A global object quarantiner will be installed, which is actually defined by the UMD build for this library.

Methods of the quarantiner global:

  • quarantiner.quarantine(...):

    quarantiner.quarantine(
        wrapper: WrapperFunction,
        config: ConfigOptions = { globals: {}, sandbox: 'default' }
    ): Promise<void>
    • wrapper: a function that defines a script to be executed inside the sandbox realm.
    • config: an optional configuration object:
      • config.globals: globals that are expected to be defined by the script, that should then be defined as globals on the main window/global object. Example: { myGlobal: { type: 'function' } }
      • config.sandbox: name of the sandbox to execute the script inside. any scripts that specify the same sandbox name will be run inside the same sandbox.
  • quarantiner.getSandbox(name: string = 'default'): Promise<Sandbox>: Allows fetching the Sandbox instance for a declared sandbox.

See also