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

osiris-educational-transpiler

v1.0.28

Published

Transpiler intended for educational purpose that translates currently python code into javascript so that it can be run on a browser .

Readme

Osiris - Educational Transpiler

Osiris is a transpiler that converts Python code to JavaScript.It also allows transpiled code execution within a web worker. It is an educational tool for those who want to learn about programming language transpilation.

Installation

npm i osiris-educational-transpiler

Usage

Python Osiris using eval()

Create an instance of the Osiris class, pass the Python code, and execute it:

import OsirisLogo from "osiris-educational-transpiler/logo";
import OsirisPython from "osiris-educational-transpiler/Python";
const transpiler = new Osiris("python");

const result = transpiler.passCode('print("Hello, World!")');

if (result.success) {
    console.log('Transpiled Code:', result.code);
    eval(result.code)
} else {
    console.error('Transpilation Error:', result.error);
}

Using python with Logo running code on web worker (Only works on browser)

To use Osiris with Python, import the Python transpiler and set up the execution environment:

import OsirisPython from "osiris-educational-transpiler/Python";
const pythonTranspiler = new OsirisPython();

// Register an event handler to capture output
pythonTranspiler.setEventHandler((event) => {
  if (event.type === 'output') {
    console.log(event.output);
  } else if (event.type === 'error') {
    console.error('Runtime Error:', event.error);
  }
});

// Optional: set a timeout to prevent infinite loops
pythonTranspiler.setExecutionTimeout(300000); // 5 minutes

// Transpile and execute
const result = pythonTranspiler.sendCode('print("Hello, Python!")');
if (result.success) {
  pythonTranspiler.runCode();
} else {
  console.error(result.errors);
}

Using Osiris with Logo (Only works on browser)

To use Osiris with Logo, import the Logo transpiler and configure it with the appropriate canvas ID where turtle graphics will be rendered.

import OsirisLogo from "osiris-educational-transpiler/logo";
const logoTranspiler = new OsirisLogo();

// Set the canvas ID where turtle graphics will be drawn
logoTranspiler.configureLanguage('canvasId', 'myCanvas');

// Register an event handler for execution output
logoTranspiler.setEventHandler((event) => {
  if (event.type === 'output') {
    console.log(event.output);
  }
});

// Transpile and execute
const result = logoTranspiler.sendCode('repeat 4 [forward 100 right 90]');
if (result.success) {
  // Ensure the canvas exists in your HTML
  const canvas = document.createElement('canvas');
  canvas.id = 'myCanvas';
  canvas.width = 800;
  canvas.height = 800;
  document.body.appendChild(canvas);

  logoTranspiler.runCode();
} else {
  console.error(result.errors);
}
```js
import OsirisLogo from "osiris-educational-transpiler/logo";
import OsirisPython from "osiris-educational-transpiler/Python";
const transpiler = new Osiris("python");

const result = transpiler.passCode('print("Hello, World!")');

if (result.success) {
    console.log('Transpiled Code:', result.code);
    eval(result.code)
} else {
    console.error('Transpilation Error:', result.error);
}

API

new Osiris()

Creates a transpiler instance for the desired language (e.g., "python" or "logo").

sendCode(code: string): object

Transpiles source code to semantically equivalent JavaScript. Returns:

  • success: boolean indicating whether the transpilation was successful.
  • code: transpiled JavaScript code (if successful).
  • errors: array of error messages (if failed).

configureLanguage(key: string, value: any)

Sets a language-specific configuration property.
Example: setting 'canvasId' for Logo turtle graphics.

setEventHandler(handler: function)

Registers a callback function to handle runtime events (e.g., output, errors, graphics commands).

setExecutionTimeout(timeoutMs: number)

Sets the maximum code execution time in milliseconds. Default is 300000 (5 minutes).

runCode()

Executes the last transpiled code inside a sandboxed Web Worker.

sendIO(userInput: string)

Sends user input to the running program (for handling things like input()).

supportedLanguages(): Array<string>

Returns a list of supported languages.