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

@runno/runtime

v0.7.0

Published

Runtime for @runno

Downloads

30

Readme

👨‍💻 Use Runno 👉 Runno.dev

📖 Documentation 👉 Runno.dev

Runno Runtime

The @runno/runtime implements all the core features to make code run. It also exports Web Components that can be used to create runno instances in your code without using iframes.

Quickstart

Start by adding @runno/runtime to your package:

$ npm install @runno/runtime

Import @runno/runtime in whatever place you'll be using the runno elements. The simplest is in your entrypoint file (e.g. main.ts or index.ts).

import '@runno/runtime';

Once you've imported them you can use runno elements on the page.

<runno-run runtime="python" editor controls>
print('Hello, World!')
</runno-run>

For the code to run though, you'll need to set some HTTP headers:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

These create a cross-origin isolated context which allows the use of SharedArrayBuffer used to implement STDIN.

Headless Usage

Runno supports a headless API.

import { headlessRunCode, headlessRunFS } from "@runno/runtime";

You can use this headless API to run code in a particular language without having to use the DOM. For example:

const result = await headlessRunCode("python", "print('Hello World!')");

If you want to provide more than a single code snippet, you can use headlessRunFS to provide each of the files, and the entrypoint file.

Styling

The runno-run element can be styled with css variables to change the height of the individual runno-editor and runno-terminal elements inside.

runno-run {
  /* Sets a specific height for the editor */
  --runno-editor-height: auto;

  /* Sets a maximum height for the editor */
  --runno-editor-max-height: 60%;

  /* Sets a specific height for the terminal */
  --runno-terminal-height: auto;

  /* Sets a minimum height for the terminal */
  --runno-terminal-min-height: 4rem;
}

By default the editor will resize to fit the content you put inside it, and the terminal will be its minimum height. If you set the element to be a fixed height, they will share the space so that the editor gets 60% and the controls and terminal get the rest.