unrun

A tool to load and execute any JavaScript or TypeScript code at runtime.

  • Types
  • ESM
License
MIT
Install Size
43.6 kB(23.9 MB)
Vulns
0
Published

Get started

$npm install unrun
$pnpm add unrun
$yarn add unrun
$bun add unrun
$deno add npm:unrun
$vlt install unrun
# Run locally
$npx unrun
$pnpm exec unrun
$npx unrun
$bunx unrun
$deno run npm:unrun
$vlx unrun

Weekly DownloadsAcross all versions

Node.js
>=20.19.0

Versions

View all versions
0.2.34
latest

Readme

unrun

Open on npmx Open on npmx Open on npmx Unit Test

unrun is a tool that enables running and loading any module at runtime (TypeScript, ESM, CJS, JSX, etc.) by bundling it with Rolldown.

Check the documentation for more details.

Install

npm i unrun

Usage

CLI
npx unrun ./path/to/file.ts
Programmatic API
  • Async
import { unrun } from 'unrun'

const { module } = await unrun({
  path: './path/to/file.ts', // Path to the module to load
})
  • Sync
import { unrunSync } from 'unrun'

const { module } = unrunSync({
  path: './path/to/file.ts', // Path to the module to load
})

Credits

unrun is highly inspired by tools like :